I verified the problem with running same insert and update clauses with .NET OleDbCommand and it worked fine.
Error occurs only when using Ibatis and it's OleDb1.1 provider.
You verified this with a test web app running on the same server with the app's culture setting as "fi-FI"? That is strange...
My thoughts are that you have a couple of options (although I haven't been involved in the development of globalized apps in a while):
- Set the culture at the ASPX page level (directive) for display
purposes but config the web app to use "en-US" so that dates match the
db server setting (or make presentation layer flexible for different
formats by even accepting the user's culture selection but keep the
rest of the app configured to match the db server settings)
- Add some app settings to your config file for display and db/server culture that can be used by the app at runtime (for example, used in your calls to set the culture in your service layer when inserting dates)
http://www.devx.com/dotnet/Article/6997/0/page/
Hope this helps!
Roberto
I'm getting "Data type mismatch in criteria _expression_" error when trying to insert or update DateTime fields in Access DB.
Problem occurs only when culture settings are different in web server and db.
In ASPX pages System.Thread.CurrentThread.CurrentCulture is Finnish "fi-FI", but default culture setting in server is "en-us".
This means that in ASPX page dates are shown in dd.mm.yyyy format, but in Windows and Access date format is mm/dd/yyyy
I verified the problem with running same insert and update clauses with .NET OleDbCommand and it worked fine.
Error occurs only when using Ibatis and it's OleDb1.1 provider.
Currently I resolved problem by setting culture in code to "en-us" right before calling mapper.Insert or mapper.Update methods, but this ain't very good solution J
Any ideas how to resolve problem?
--------------------------------------------
Mr Jouni Karppinen tel. +358 44 567 9478
Software Designer addr. Microkatu 1, PL 1188
Entegra Oy 70211 KUOPIO FINLAND
www.entegra.fi Integrating Enterprises and Information