table附近有语法错误
调试
SqlConnection myConn = GetConnection();
myConn.Open();
string sqlStr = "select * from tb_Class ";
SqlDataAdapter myDa = new SqlDataAdapter(sqlStr, myConn);
DataSet myDs = new DataSet();
myDa.Fill(myDs);
GridView1.DataSource = myDs;
GridView1.DataKeyNames = new string[] { "ClassID" };
GridView1.DataBind();
myDa.Dispose();
myDs.Dispose();
myConn.Close();
运行到 myDa.Fill(myDs);时说tb_Class附近有语法错误,本人一直找不出原因想问下大家是哪里出了问题???
------解决方案--------------------表示看不出来。直接把"select * from tb_Class "去掉引号后扔到查询器里看看。
------解决方案--------------------GridView1.DataSource = myDs[0]