我从SQL上取出一个表,合并到ACCESS表上(两个表结构是一样的),为什么更新不到ACCESS上???返回的DATASET里已经是合并后的值了,下面语句是有错误吗?参数分别为SQL上获得的表的DATASET,本地ACCESS查询的语句(和SQL上是一样的),ACCESS表上需要设为主键的字段名public DataSet OleBusinessUpdate(DataSet sqlDataSet,string strSql,string strPrimary)
{
DataSet theDataSet=new DataSet();
OleDbConnection theConnection = new OleDbConnection(olecnn);
theConnection.Open(); OleDbDataAdapter theAdapter = new OleDbDataAdapter();
theAdapter.SelectCommand = new OleDbCommand(strSql, theConnection); OleDbCommandBuilder theBuilder = new OleDbCommandBuilder(theAdapter ); theAdapter.FillSchema(theDataSet, SchemaType.Mapped); theAdapter.Fill(theDataSet);
DataColumn[] myColArray = new DataColumn[1];
myColArray[0] = theDataSet.Tables[0].Columns[strPrimary];
theDataSet.Tables[0].PrimaryKey = myColArray; theDataSet.Merge(sqlDataSet.Tables[0]);
theAdapter.Update(theDataSet.Tables[0]); 
return theDataSet;
}