我正在开发一个在线预订,并且从客户端页面我想通过gridview查看他的交易,但是程序返回错误并且它说“附加信息:过程或函数'JoinRoomSubPayment'期望参数'@USERNAME',这是没有提供的。“
这是我的代码:
SQL:
SELECT USERNAME, FIRST_NAME, LAST_NAME, BIRTHDAY, CONTACT_NUMBER, EMAIL_ADDRESS, HOME_ADDRESS FROM TBL_Client
WHERE USERNAME = @USERNAME
ClassDisplaySummary.cs:
public DataSet _JoinRoomSubPayment(string user){
conn.Open();
SqlCommand cmd = new SqlCommand("JoinRoomSubPayment", conn);
cmd.Parameters.Add("@USERNAME", SqlDbType.VarChar).Value = user;
cmd.ExecuteNonQuery();
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
ds.Clear();
da.Fill(ds, "_JoinRoomSubPayment");
conn.Close();
return ds;}
ClientPage.aspx.cs:
user = Session["username"].ToString();
SummaryGView.DataSource = cd._JoinRoomSubPayment(user).Tables["_JoinRoomSubPayment"];
SummaryGView.DataBind();
任何帮助将不胜感激
答案 0 :(得分:0)
您的声明似乎正确可能由于cmd.ExecuteNonQuery()而发生此错误;从代码中删除此行,然后尝试
id