Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 311
  • Last Modified:

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 ?
0
Vartana
Asked:
Vartana
  • 2
  • 2
1 Solution
 
BillAn1Commented:
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

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now