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

converting from char to datetime

Status
Not open for further replies.

ccampbell

Programmer
Joined
Aug 16, 2001
Messages
201
Location
US
I have the following piece of code C++ code that is giving me some problems.

char strSQL[1024];
sprintf(strSQL,("INSERT INTO TEMPTABLE(col1, col2)VALUES('val1','val2')","string1", "string2");

Then I Execute this statement by passing this entire string into the Execute function.

If col2 is a datetime field in the database, how can I get around this issue? (right now I am inserting a char not a datetime value) Any help is greatly appreciated. THanks
 
Make sure the date string you are passing to SQL is in a valid format. usually i use mm/dd/yyyy hh:mm and sql should be able to handle the conversion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top