Hello
Anybody knows how parameter can be passed in correctly:
There are 2 table, "sp" is one of the table that will be used depending on a session. I need to pass a dropdownlist value into the query like:
table123.ID = ddlItem.Selecte dValue;
GetLists(table1 23);
Anybody knows how parameter can be passed in correctly:
There are 2 table, "sp" is one of the table that will be used depending on a session. I need to pass a dropdownlist value into the query like:
table123.ID = ddlItem.Selecte dValue;
GetLists(table1 23);
Code:
public DataSet GetLists(table123 pref)
{
new SqlCommand("select b.ID2 from " + sp + " a, tb2 b where a.ID=b.ID and d.ID=@id", cn);
cm.Connection = cn;
cm.Parameters.Add(p1);
cm.Parameters[@id].Value = pref;
ds = new DataSet();
da = new SqlDataAdapter(cm);
da.Fill(ds, "GetLists");
return ds;
}
Comment