DropDownList选择某个值后,点击确定按钮,然后根据选的这个值在datagrid显示数据库相关数据
我的代码如下:private void Btn_ok_Click(object sender, System.EventArgs e)
{
string strconn = ConfigurationSettings.AppSettings["ConnectionString"];
cn = new SqlConnection(strconn);
SqlCommand cm = new SqlCommand("line", cn);
cm.CommandType = CommandType.StoredProcedure;
cm.Parameters.Add(new SqlParameter("@day", SqlDbType.VarChar, 8));
cm.Parameters["@day"].Value = Ddl_kind.SelectedValue.ToString();
try
{
SqlDataAdapter myAdapter = new SqlDataAdapter();
myAdapter.SelectCommand = cm;
DataSet ds = new DataSet();
myAdapter.Fill(ds);
datagrid1.DataSource = ds;
datagrid1.DataBind();
}
catch
{ }
}
请问哪里有问题