-
I got a problem, i am using VB 6 to write a DB app and it connects to a SQL server 6.5, in the database two fields, TimeLogged and DateLogged are both datetime datatypes. In VB my date and times to add to the database are both strings.
How can i get SQL server 6.5 to add them to the record( by converting them to datatime????) Please Help
-
Check out the CONVERT function in SQL server 6.5. it goes like this...
CONVERT(datetime, @yourdatestring, 101)
If you just put 'MM/DD/YYYY', then the function will automatically set the time to 00:00:00.
Anyway, just check it out.
-
This it the sql statment
sqlTemp = "INSERT INTO tCallLog (IndexNumber, LoggedBy, ForConsultant, Client, Person, Timelogged, DateLogged, Notes, Urgent, Priority, WasRespondedTo) VALUES ( MAX('IndexNumber') + 1, '" & CurrentUser.username & "', '" & cmbConsultant.Text & "', '" & txtClient.Text & "', '" & txtPerson.Text & "', '" & txtTimeLogged.Text & "', '" & Format(Now, "dd/mm/yyyy") & "' , '" & Chr(35) & txtNotes.Text & Chr(35) & "', " & chkUrgent.Value & ", '" & cmbPriority.ListIndex & "', " & chkWasRespondedTo.Value & " );"
ok ... table:
IndexNumber int
LoggedBy char
ForConsultant char
Client varchar
Person varchar
TimeLogged text
DateLogged text
Notes text (in vb multiline textbox)
Urgent int
Priority int
WasRespondedTo int
please help the error i keep getting is:
"Implicit Conversion from datatype 'varchar' to 'int' is not allowed. Use the CONVERT function to run this query."
but i cant find what is causing the error!