Group: microsoft.public.dotnet.framework
From: "mik"
Date: Friday, November 16, 2007 10:05 AM
Subject: Re: OleDbCommandBuilder - Data type mismatch in criteria expression

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


"Alexander Vasilevsky" ha scritto nel messaggio
news:fhip6s$2pcg$1@behemoth.volia.net...
> Unfortunately not enough information. Please show your code and sql
> script.
>
> http://www.alvas.net - Audio tools for C# and VB.Net developers
>
>
> "mik" ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
> news:%NU_i.173882$U01.1197475@twister1.libero.it...
>> 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
>>
>>
>
>


Safety Articles | News in English | 20lbs in 30 days | Bluegrass | Usenet Newsfeeds