OleDbDataAdapter catDA = new OleDbDataAdapter( "SELECT 类别ID, 类别名称 FROM 类别 ", nwindConn);
catDA.UpdateCommand = new OleDbCommand( "UPDATE 类别 SET 类别名称 = ? " +
"WHERE 类别ID = ? ", nwindConn);
catDA.UpdateCommand.Parameters.Add( "@类别名称 ", OleDbType.VarChar, 15, "类别名称 ");
OleDbParameter workParm = catDA.UpdateCommand.Parameters.Add( "@类别ID ", OleDbType.Integer);
workParm.SourceColumn = "类别ID ";
workParm.SourceVersion = DataRowVersion.Original;
DataSet catDS = new DataSet();
catDA.Fill(catDS, "类别 ");
DataRow cRow = catDS.Tables[ "类别 "].Rows[0];
cRow[ "类别名称 "] = "New类别名称 ";
catDA.Update(catDS);
在最后一句产生的错误提示: "Update 无法找到 TableMapping[ 'Table '] 或 DataTable'Table'。 "
请问怎样解决呢?
------解决方法--------------------------------------------------------
try..
catDA.Update(catDS, "类别 ");
------解决方法--------------------------------------------------------
catDA.Fill(catDS, "类别 ")改成catDA.Fill(catDS)应该也会出错,一般我后面都加表名的