Data for .NET 3.5 has been transferred to an Access database in an ASP.NET Webform project. The site runs IIS 6 on Windows 2003 (English Sarsian).
ASPX file is used for reading and writing a data card. Reading data works fine, but writing dates fail. But written works, if the date is provided in MM-DD-Yay, but dd.mm.yyyy does not work. If the date has been provided as dd.mm.yyy I get this error:
System.Data.OleDb.OleDbException: Data type mismatch in criteria expression.
A code example for this error:
AccessDataSource myAds = New AccessDataSource ("~ / App_Data / mydb.mdb", ""); MyAds.InsertCommand = "INSERT [Table 1]" + [(value), [date]) VALUES ( 'data', the date value ( '' + Dinanktaim. Now. Tostring ( "DD. M.am.aai") + "'))"; MyAds.Insert ();
Regional and language settings are set to German and therefore the correct date format. The database is stored in the date and time in the DateTime field.
Without changing the Hundrade to pages of heritage code, what do I have to do to improve it?
it
dateTime.Now.ToString ("yyyy-MM -dd ") Change
If you are trying to insert the current date time, you can do this
" INSERT [table1] "+ [[Value], [Date]) VALUES ('data', now and ())";
No comments:
Post a Comment