Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting from VB .Net into Access

Status
Not open for further replies.

zrefugee

Technical User
Jan 19, 2004
22
US
I'm working on a VB .Net program that uses an Access database. I can't seem to find a way to insert a datetime value. No matter what I try I keep getting "Data type mismatch in criteria expression". Any help with this would be greatly appreciated.
 
The date delimiter for access is the pound sign (#).

So try this in place of the string you are trying to insert:
Code:
 "#" + myDateString + "#"

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
Is it cold over there Chrissie1?

Ignorance of certain subjects is a great part of wisdom
 
Alex I've already tried that and still get "Data type mismatch in criteria expression" no matter how I how format the date string. I've worked more with SQL Server and MySQL and this has not been a problem.
 
Maybe you should post the code you are using, and some info on the Access database as well.

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
Perhaps you should use the parameters that come with the command object. This way you also prevent sql-injection and any future problems with dates (like the fact that the dafult can change on the serverside).

Christiaan Baes
Belgium

"My old site" - Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top