How would i take the VB.net NOW and convert to SQL date/time ?

How would i take the VB.net NOW and convert to SQL date/time ?


8/22/2004 2:58:12 PM
to SQL date time ?
LVL 1
VartanaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
BillAn1Connect With a Mentor Commented:
in VB.Net I believe you can use CDate(), however SQLServer will recognize '8/22/2004 2:58:12 PM'  as a valid datetime
0
 
VartanaAuthor Commented:
this does not work

            sSQL = " UPDATE Arrears" & _
                    " SET InUse = " & InUse & ", Called = - 1, LastView = " & Now & _
                    " WHERE CustomerAcctNumber = '" & sAccount & "' AND BillingCycleID =" & BillingCycleID
0
 
BillAn1Commented:
You just need to quote it in single quotes -

sSQL = " UPDATE Arrears" & _
                    " SET InUse = " & InUse & ", Called = - 1, LastView = '" & Now & "'" & _
                    " WHERE CustomerAcctNumber = '" & sAccount & "' AND BillingCycleID =" & BillingCycleID
0
 
VartanaAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.