OleDbCommandBuilder - Data type mismatch in criteria expression

  • Thread starter Thread starter mik
  • Start date Start date
M

mik

Hi, i'm using an OleDbCommandBuilder to update data from a dataset to a
access database.
It work fine, but if i use a table with a decimal column data type, i
get this error, when performing the update

Data type mismatch in criteria expression

i've understood that the error is due to the comma or dot in the decimal
representation in the sql statements, but they are created automatically
by the command builder.
Any idea on how to fix that?
Thanks
 
The update routine is this:
public int UpdateDataSet(DataSet ds, string selectSQL, string tableName,
DbTransaction transaction)

{

OleDbDataAdapter da = new OleDbDataAdapter(selectSQL, conn);

OleDbCommandBuilder cb = new OleDbCommandBuilder(da);

cb.QuotePrefix = "[";

cb.QuoteSuffix = "]";



cb.SetAllValues = true;




da.SelectCommand.Transaction = (OleDbTransaction)transaction;

da.RowUpdating += new OleDbRowUpdatingEventHandler(da_RowUpdating);

da.RowUpdated += new OleDbRowUpdatedEventHandler(da_RowUpdated);

cb.RefreshSchema();

OleDbCommand cmd = cb.GetUpdateCommand();



da.UpdateCommand = cmd;

return da.Update(ds, tableName);


}



this works fine except if the table i'm updating contains a decimal column
data type, in this case i get the error:

Data type mismatch in criteria expression

thanks
 
Back
Top