0
有人请通过调用此代码来帮助我。当我通过存储过程调用检索登录值时,出现此错误消息“过程或函数'GetUserLogin'期望参数'@UserName',那是不供给的。” 这里是我的代码:在存储过程视图数据需要帮助
public int GetLogin(string UserName, string Password)
{
SqlConnection con = new SqlConnection(str);
SqlDataAdapter da = new SqlDataAdapter("GetUserLogin", con);
SqlCommand com = new SqlCommand("GetUserLogin",con);
com.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
if ((ds.Tables[0].Rows[0].ItemArray[1].ToString() == UserName) && (ds.Tables[0].Rows[0].ItemArray[2].ToString() == Password))
{
return 1;
}
else
{
return 0;
}
}
else
{
return -1;
}
StoredProcedure:
CREATE PROCEDURE GetUserLogin @UserName varchar(50)
AS
select UserName,
Password
From Login where [email protected]
RETURN
感谢, Masum
这不起作用。你需要使用“@Username” – Aheho 2009-02-13 23:08:51