reza69
شنبه 01 آبان 1395, 23:57 عصر
سلام
چطور باید پارامتر را به رویه ارسال کرد؟
این کد های من هست. ولی ارور میده
create procedure select_vsubmenu_input_mainid
(
@mainid int
)
AS
BEGIN
select * from t_vsubmenu where mainid=@mainid
end
کد C#:
SqlCommand command = new SqlCommand("select_vsubmenu_input_mainid", con);
SqlParameter param;
command.CommandType = CommandType.StoredProcedure;
param = new SqlParameter("@mainid", Convert.ToInt32(ds4.Tables[0].Rows["fid"].ToString()));
param.Direction = ParameterDirection.Input;
param.DbType = DbType.String;
command.Parameters.Add(param);
SqlDataAdapter da6 = new SqlDataAdapter("select_vsubmenu_input_mainid", con);
DataSet ds6 = new DataSet();
da6.Fill(ds6, "select_vsubmenu_input_mainid");
DataTable db6 = ds6.Tables["select_vsubmenu_input_mainid"];
ارور:
[I]Procedure or function 'select_vsubmenu_input_mainid' expects parameter '@mainid', which was not supplied.
چطور باید پارامتر را به رویه ارسال کرد؟
این کد های من هست. ولی ارور میده
create procedure select_vsubmenu_input_mainid
(
@mainid int
)
AS
BEGIN
select * from t_vsubmenu where mainid=@mainid
end
کد C#:
SqlCommand command = new SqlCommand("select_vsubmenu_input_mainid", con);
SqlParameter param;
command.CommandType = CommandType.StoredProcedure;
param = new SqlParameter("@mainid", Convert.ToInt32(ds4.Tables[0].Rows["fid"].ToString()));
param.Direction = ParameterDirection.Input;
param.DbType = DbType.String;
command.Parameters.Add(param);
SqlDataAdapter da6 = new SqlDataAdapter("select_vsubmenu_input_mainid", con);
DataSet ds6 = new DataSet();
da6.Fill(ds6, "select_vsubmenu_input_mainid");
DataTable db6 = ds6.Tables["select_vsubmenu_input_mainid"];
ارور:
[I]Procedure or function 'select_vsubmenu_input_mainid' expects parameter '@mainid', which was not supplied.