这是我正在使用的代码..我想将下拉选择的项目作为输入传递给存储过程并执行..我怎么能做到这一点?
public class DaysForEvents
{
public DataSet GetDaysForEvents(//This should be my input to stored procedure (i.e) dropdownselected value)
{
SqlConnection con = new SqlConnection(CommonSettings.GetEventsConnectionString());
try
{
SqlCommand sqlcmd = new SqlCommand("proc_fetch_event_days", con);
SqlDataAdapter sqlda = new SqlDataAdapter(sqlcmd);
DataSet ds = new DataSet();
//DateFilter = 0;
//StatusFilter = 0;
sqlcmd.CommandType = CommandType.StoredProcedure;
sqlcmd.Parameters.AddWithValue("@event_id", Event_id);
// sqlcmd.Parameters["@UserID"].Value = UserID;
con.Open();
sqlda.Fill(ds);
con.Close();
return ds;
}