I am very upset here, tried this for a few days ... All I want is for German users to enter dates that should be stored in SQL Server. Dates are in the following format: "dd.mm.yyyy". I always get error messages like this: Syntax date error in query expression '# 23.01.2004 00: 07: 00 #'. - using Access at the moment.
I tried many methods (Thread.CultureInfo, CDate (), Formatting DateTimeStyles), but here is my last one:
Dim dTermin As DateTime
dTermin = DateTime.Parse(txtTermin.Text)
sSQL = "INSERT INTO Termin (Termin) VALUES ("
sSQL = sSQL & "#" & dTermin & "#)"
It also gives me an error. However, if I encode a date like "10-04-2004", then it works. This is Access 2000 db, and there are two fields: ID (Autonumber) and Termin (ShortDate). Using the Jet OLEDB 4.0 Provider
pinku source
share