public DataSet abc(SqlConnection conn1,SqlDataAdapter da1)
{
//创建连接对象,并指明要连接的数据库名称、用户名、用户密码
SqlConnection conn1 = new SqlConnection("data source=(local);database=****;user=****; password=********");
SqlDataAdapter da1 = new SqlDataAdapter(); //创建数据适配器
DataSet ds1 = new DataSet(); //创建DataSet(数据集)
String yefeng = DropDownList1.SelectedItem.ToString() + "年" + DropDownList2.Text + "月";
string strSQL = "select Count(*) from baobiao where WJLX=" + (RadioButtonList1.SelectedIndex.ToString() + 1) + "and MYDATE=" + "'" + yefeng + "'";
//适配器对象的查询命令
SqlCommand cmdSel = new SqlCommand(strSQL, conn1); //创建DataAdapter(数据适配器)
da1.SelectCommand = cmdSel;
da1.Fill(ds1, "baobiao"); //使用数据适配器填充数据集
return ds1;
}
我是2.0超级菜鸟,请多多教导!