在存储过程中传递唯一密钥的问题 [英] Problem in passing unique key in Stored Procedure

查看:63
本文介绍了在存储过程中传递唯一密钥的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

当我运行我的代码时,出现以下问题...

代码是

Hello,

While I am running my code i got following problem...

code are

public DataTable GetAllById(string Did)
    {
        DataTable tableMpr=null;
        id=new Guid(Did.ToString ()); 
        con.Open();
        DataSet ds = new DataSet();                      
        SqlDataAdapter sda = new SqlDataAdapter("uuspGetAllMprOneById", con);
        sda.SelectCommand.Parameters.Add(new SqlParameter("@Id",          SqlDbType.UniqueIdentifier));
        sda.SelectCommand.Parameters["@Id"].Value = id;
        sda.Fill(ds);
        tableMpr = ds.Tables[0];
        con.Close();
        return tableMpr;
}


我的存储过程是


and My stored procedure is

alter PROCEDURE [dbo].[uuspGetAllById]
    @ID uniqueidentifier
AS
SET NOCOUNT ON
Select * from mUsers where DId=@ID

return



在运行此代码时,出现以下错误..

过程或函数"uuspGetAllById"需要未提供的参数"@ID".

我不知道我在哪里缺少

提前进行Thnak的操作..



While Running this Code I got following error..

Procedure or function ''uuspGetAllById'' expects parameter ''@ID'', which was not supplied.

I don''t know where i am lacking

Thnak''s in advance..

推荐答案

请重命名:@Id为@ID

祝...结束...

Morgs
Please rename: @Id to @ID

Happy ....ending

Morgs


嗨Fanjolama,

我认为您正在调用wearg存储过程.请检查以下两行,并确认两者是否相同.


1)SqlDataAdapter sda =新的SqlDataAdapter("uuspGetAllMprOneById",con);
2)
hi Fanjolama,

I think you are calling worng stored procedure. Please check the below two lines and will conform both are same or not.


1) SqlDataAdapter sda = new SqlDataAdapter("uuspGetAllMprOneById", con);
2)
alter PROCEDURE [dbo].[uuspGetAllById]



在最简单的一种中,您正在调用"uuspGetAllMprOneById",但是您的存储过程名称是uuspGetAllById

所以请检查一下.一旦检查,请告诉我这是正确还是错误.

问候,
venkat panepalli



In friest one you are calling "uuspGetAllMprOneById" but your stored procedure name is uuspGetAllById

So please check it.. once it check let me know this is correct or not.

Regards,
venkat panepalli


alter PROCEDURE [dbo].[uuspGetAllById]
    @Id uniqueidentifier
AS
SET NOCOUNT ON
Select * from mUsers where DId=@Id

return


这篇关于在存储过程中传递唯一密钥的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆