我在dataGrid中通过form_load显示查询结果后,打算通过按钮对查询结果更新,可是按钮下的代码怎么写不对,郁闷好几天了,恳请大家帮忙~~~下面是form_load中的代码:
myConnection = new SqlConnection("Integrated Security=sspi;initial Catalog =Fnew;Data Source=JYK1");
String selectCmd = "select * from songy where number=@number";
myCommand=new SqlDataAdapter(selectCmd,myConnection);
myCommand.SelectCommand.Parameters.Add(new SqlParameter("@number", SqlDbType.Char));
myCommand.SelectCommand.Parameters["@number"].Value ="001";
DataSet ds=new DataSet();
myTable=new DataTable();
myCommand.Fill(ds,"myTable");
this.dataGrid1.DataSource = this.ds["myTable"];