strsql = "select id as'方案编号',prereagentid as '试剂编号' ,prereagent as '试剂名称',preamount as '试剂用量'
from project where id = (select Max(id)+1 from remarks)";
this.myconn = new SqlConnection(strconn);
this.da = new SqlDataAdapter(strsql, strconn);
this.ds = new DataSet();da.Fill(ds, "data");
SqlCommandBuilder bd = new SqlCommandBuilder(da);
da.InsertCommand = bd.GetInsertCommand();
da.Update(ds.Tables["data"]);
//以上代码,如果稍不留神,就会忽略掉data名称,程序便出错。也就是说,如果写成
da.Fill(ds);
……
da.Update(ds);
//就必然会出错,必须得有表名。