VB6 and SQL mistake
Here is a line of code in SQL I am attempting to use in VB6.
Dim Sqlstring As String
Sqlstring = "Update TroubleTickets set ResolvedDate = ' " + DateValue(Now) + "' where Title ='" + Trim(TicketComboBox.Text) + "'"
I am getting an error tha开发者_高级运维t says types do not match when i run the debugger.
any suggestions?
Dim Sqlstring As String
Sqlstring = "Update TroubleTickets set ResolvedDate = ' " & DateValue(Now) & "' where Title ='" & Trim(TicketComboBox.Text) & "'"
The concat-operator in VB is the ampersand &
.
You get a type mismatch error because VB expects a number if you use +
.
You should also consider using prepared statements to insert parameters into SQL queries.
精彩评论