莫名奇妙的错误
头文件加 using System.Data.SqlClient;//定义DataSet private DataSet ds = new DataSet();
private SqlDataAdapter da;
添加控件dataGridView1
程序代码:
SqlConnection con = new SqlConnection("server=.;database=学生数据库1;uid=sa;pwd=;"); con.Open(); string sqlSel = "select * from 促销记录"; SqlCommand com = new SqlCommand(sqlSel, con); da = new SqlDataAdapter(sqlSel, con); this.ds.Clear(); da.Fill(ds, "促销记录"); this.dataGridView1.DataSource = ds.Tables["促销记录"].DefaultView; con.Close();
提示:da.Fill(ds, "促销记录");错误
奇怪了!求高手回答