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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting Date data type Into SQL Server using ADOs Connection

Status
Not open for further replies.

Jonid

Programmer
May 4, 2001
24
AE
How Do i insert Date Data into Sql Server DB Using ADO objects???
i tried this but it didnt work

sql = "insert into table(datetimefield) values("
sql = sql & "'" & datevariable & "')"

cnn.execute sql
-----------------------------------------

error message i get is :
error converting datetime from char string

i tired useing now() function instead of datavariable for testing but i get the same message

any idias???

 
Use the pound symbols to work with date and time variables. use the following sql statement instead:

sql = "insert into table(datetimefield) values(#" & datevariable & "#)"
Best Regards and many Thanks!
Michael G. Bronner X-)

"Beer is proof that God wants us to be happy." Ben Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top