Inserting date into db access in vb
I am a bit stuck and I have no idea what I am doing wrong. I want to insert current date into MS Access database in VB. Part of the code im having problems:
SQLString = "INSERT INTO Sales(DateSold) VALUES ("
SQLString += Date.Today & ")"
The type in the database is date and dd / mm / year. Thanks in advance for your help.
+2
Shane fagan
source
to share
3 answers
If you haven't used SQL NOW (), you can quote the date:
SQLString = "INSERT INTO (Sales) VALUES ("
SQLString += "'" & Date.Today & "')"
+2
danseagrave
source
to share
why don't you allow date access:
"INSERT INTO SALE VALUES (NOW ())"
0
Jabezz
source
to share
Can you use CultureInfo to set your date formats?
0
Tikeb
source
to share