下列代码去掉注示行后出错,无法在DataSet中更新数据,不知为什么?????????????????????
string myConnection="user id=sa;password=toney;initial Catalog=TestDB;Data Source=localhost";
string mySelectQuery="select * from company";
SqlConnection myConn =
new SqlConnection(myConnection);
SqlDataAdapter myDataAdapter =
new SqlDataAdapter();
myDataAdapter.SelectCommand =
new SqlCommand(mySelectQuery, myConn);
SqlCommandBuilder cb =
new SqlCommandBuilder(myDataAdapter);
myConn.Open();
DataSet ds =
new DataSet();
myDataAdapter.Fill(ds, "company");
//ds.Tables["company"].Rows[0]["companyip"]="202.11.62.99";
myDataAdapter.Update(ds, "company");
myConn.Close();