SqlConnection con = new SqlConnection("server=.;database=Northwind;uid=sa;pwd=19820924;");
con.Open();
SqlCommand com = con.CreateCommand();
com.CommandText = "Select * from Student";
//SqlCommand com = new SqlCommand("Select * from Student",con);
// con.Open();
// SqlDataReader dr = com.ExecuteReader();
//
// while(dr.Read())
// Console.WriteLine("\t{0}\t{1}",dr["ID"],dr["Name"]);
//
// dr.Close();
// con.Close();
SqlDataAdapter thisAdapter = new SqlDataAdapter(com.CommandText,con);
SqlCommandBuilder thisBuilder = new SqlCommandBuilder(thisAdapter);
DataSet thisDataSet = new DataSet();
thisAdapter.Fill(thisDataSet,"Student");
Console.WriteLine("name before change is: {0}",thisDataSet.Tables["Student"].Rows[1]["Name"]);
thisDataSet.Tables["Student"].Rows[1]["Name"] = "wang";
thisAdapter.Update(thisDataSet,"Student");
Console.WriteLine("name before change is: {0}",thisDataSet.Tables["Student"].Rows[1]["Name"]);
con.Close();
对于不返回任何键列信息的 SelectCommand 不支持 UpdateCommand 的动态 SQL 生成,提示这样的错误是怎么回事呀?