I am trying to update a modified dataset as given below. I am getting the error. How can I correct the issue?
An unhandled exception of type ‘System.InvalidOperationException’ occurred in System.Data.dll
Additional information: Update unable to find TableMapping[‘Table’] or DataTable ‘Table’.
string strAccessConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Program Files\\ASWorx Products\\ASWorx200\\Database\\GemDatabase.mdb";
string strAccessSelect = "SELECT * FROM VariableTable";
// Create the dataset and add the Categories table to it:
DataSet myDataSet = new DataSet();
OleDbConnection myAccessConn = new OleDbConnection(strAccessConn);
OleDbCommand myAccessCommand = new OleDbCommand(strAccessSelect, myAccessConn);
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(myAccessCommand);
myAccessConn.Open();
myDataAdapter.Fill(myDataSet, "VariableTable");
DataRowCollection dra = myDataSet.Tables["VariableTable"].Rows;
foreach (DataRow dr in dra)
{
dr[1] = "SV";
break;
}
myDataAdapter.Update(myDataSet);
You need to use OleDbCommandBuilder object – which generates single-table commands.
To udate Dataset result,