"Data type mismatch in criteria expression" from C# app in French

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I get a "Data type mismatch in criteria expression" error when attempting to
write to an Access database in my C#.NET Windows Forms application. This
only occurs when the OS regional settings are set to French. When they are
set to English, the write query works fine. I use System.Data.OleDb.

The parameter types are set to DbType.Guid, DbType.String, and
DbType.Decimal where applicable. There are NO dates.

This is the query that is executed:

PARAMETERS [@AdvisorID] Guid, [@UserID] Text ( 255 ), [@UserPassword] Text (
50 ), [@URL] Text ( 255 ), [@Logo] Text ( 255 ), [@UICulture] Text ( 255 ),
[@OutputCulture] Text ( 255 ), [@CapitalGainsInclusionRate] IEEEDouble,
[@DefaultTaxRate] IEEEDouble, [@PrintSummaryDefault] Text ( 9 ),
[@FullStandardDefault] Text ( 9 ), [@DefaultCorpTaxRate] IEEEDouble,
[@DefaultCapitalTaxRate] IEEEDouble, [@DefaultAIRateSpread] IEEEDouble,
[@DefaultAUInterestPct] IEEEDouble, [@DefaultAIDividendPct] IEEEDouble,
[@DefaultAICGPortion] IEEEDouble, [@DefaultAIUCGPortion] IEEEDouble;
INSERT INTO Advisor ( AdvisorID, UserID, UserPassword, URL, Logo, UICulture,
OutputCulture, CapitalGainsInclusionRate, DefaultTaxRate,
PrintSummaryDefault, FullStandardDefault, DefaultCorpTaxRate,
DefaultCapitalTaxRate, DefaultAIRateSpread, DefaultAIInterestPortion,
DefaultAIDividendPortion, DefaultAICGPortion, DefaultAIUCGPortion )
SELECT [@AdvisorID] AS Expr1, [@UserID] AS Expr2, [@UserPassword] AS Expr3,
[@URL] AS Expr5, [@Logo] AS Expr6, [@UICulture] AS Expr7, [@OutputCulture] AS
Expr8, [@CapitalGainsInclusionRate] AS Expr9, [@DefaultTaxRate] AS Expr10,
[@PrintSummaryDefault] AS Expr11, [@FullStandardDefault] AS Expr12,
[@DefaultCorpTaxRate] AS Expr13, [@DefaultCapitalTaxRate] AS Expr14,
[@DefaultAIRateSpread] AS Expr15, [@DefaultAUInterestPct] AS Expr16,
[@DefaultAIDividendPct] AS Expr17, [@DefaultAICGPortion] AS Expr18,
[@DefaultAIUCGPortion] AS Expr19;


I can't for the life of me figure out why it would work under English
regional settings but not French. I assume something related to formatting
is occurring, but I don't know why. Does anyone have any ideas?

Thanks

Greg
 
Greg,

You know that OleDb does not use the names of the parameters however the
sequence of existence.

Cor
 
Yes, I do that as a form of documentation. The fields are added in the same
order they are expected by the query in Access.
 
Greg,

Not that I see directly something, sounds strange for me as well, however
just guessing, do you use in the French culture maybe more extended
characters?

Cor
 
No - exactly the same set as with English. I suspect it probably has
something to do with the decimal fields and that perhaps the OleDb code
somehow converts them to string before sending them over to the Jet engine.
For all I know, maybe a SQL statement is created first. I know that Access
will only accept US formatting for dates. If it is in fact doing a
conversion to text, then I am at a loss as to what to do.
 
Greg,

When what you write is true than should be the major part of the world be in
trouble. Only the US, English speaking Candada and the ones who use the
dates in a Coca Cola cultures use the US style of dates.

As well is in most not English language parts of the world standard to use a
comma as decimal point.

AFAIK are the datetimes in Access the same as in SQL server written in
ticks.

Cor
 
Back
Top