It might depend on the database oledb provider.
Which database are you using?
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development
www.rthand.com Blog:
http://cs.rthand.com/blogs/blog_with_righthand/ [quoted text, click to view] "Heinz Kiosk" <nospampleasetom.mcclelland@ntlworld.com> wrote in message
news:aIyDi.44822$S91.11248@newsfe7-win.ntli.net...
> Hi,
>
> The following code works fine on a UK/US machine but fails on a French
> machine. I've isolated the failure to the "," decimal point on French
> machines by using customise on Regional Settings in Control Panel.
>
> I've found other references on the web to this problem but the responses
> have been a mixture of, "I don't believe that such a basic problem could
> exist in the implementation of decimals in ADO.NET" and plain
> misunderstanding of the problem. I haven't been able to find any solutions
> other than getting rid of "," for decimal point, which some continental
> europeans won't agree to do.
>
> OleDbConnection conn = new OleDbConnection(SomeConnectionString);
> conn.Open();
>
> // The exact mechanism for creating the adapter select and
> // update commands seems to be irrelevant
> // Likewise this failure occurs with VS2005 wizard-generated
> // adapters and typed datasets too.
> OleDbDataAdapter adapter = new OleDbDataAdapter("Select * from
> sometable", conn);
> OleDbCommandBuilder builder = new OleDbCommandBuilder(adapter);
> adapter.UpdateCommand = builder.GetUpdateCommand();
>
> DataTable t = new DataTable();
> t.Columns.Add(new DataColumn("Payroll", typeof(String)));
> t.Columns.Add(new DataColumn("HoursPerPeriod", typeof(Decimal)));
> // the decimal column is the problem
> adapter.Fill(t);
> t.Rows[0]["HoursPerPeriod"] =
> Convert.ToDecimal(t.Rows[0]["HoursPerPeriod"]) + 1;
> // The next line throws the exception
> // "Data Type Mismatch in Criteria Expression"
> // on machines with ',' for decimal point in regional settings
> // but UK and US machines work fine...
> adapter.Update(t);
>
> Thanks in advance for any light shed on this problem.
>
> Kind Regards
>
> Tom