string sql = "SELECT * FROM A where 1 = 0";
sCommand = new SqlCommand(sql, sqlconn);
sAdapter = new SqlDataAdapter(sCommand);
sDs = new DataSet();
sAdapter.Fill(sDs, "A");
sTable = sDs.Tables["A"];
SqlCommandBuilder builder = new SqlCommandBuilder(sAdapter);
sAdapter.InsertCommand = builder.GetInsertCommand();
row = sTable.NewRow();
sTable.Rows.Add(row);
row["name"] = "123";
row["ln"] = vendor;
row["droptotype"]=type;
...
row["price"] = cost;
row["create_by"]=sysuser;
sAdapter.Update(sDs, "A");
上面程序执行没有问题,但我在后台把表A新增了一个字段create_by,
其他字段仍能更新到表A,但create_by无法更新,
请大侠帮忙看看什么问题?谢谢
------解决思路----------------------
没有错误信息?字段与数据类型是否一致?
------解决思路----------------------
后台 新增的,数据表里有没有对应的字段名称;名称有么有拼错
------解决思路----------------------
什么叫后台新增的?数据库中是否有create_by字段?
------解决思路----------------------
打个断点看看InsertCommand的值是什么