Microsoft
Software
Hardware
Network
Question : SQL - Dates syntax ( VB6 connecting to SQL Server database)
Hi Experts
I'm trying to update a table with new [Test Requests]. It's in VB6, connecting to a SQL database and it's designed to select tests, requested after the [lastupdate] date. Just a syntax assist on the troublesome line.
eg
LastUpdate = "21/12/2009"
'select most recent tests
rs.CursorLocation = adUseClient
Sql = ""
Sql = Sql & " Select * from REQUESTEDTESTS "
'Sql = Sql & " where convert(varchar, [requestdate],120) > " .........datevalue(LastUpd
ate)??
'some examples of what i have tried
'/Sql = Sql & " where convert(varchar, [requestdate],120) > " & DateValue(LastUpdate) ' conversion failed
'/Sql = Sql & " where convert(varchar, [requestdate],120) > convert(varchar, [lastupdate],120)" 'invalid column
'/Sql = Sql & " where convert(varchar, [requestdate],120) > getdate(lastupdate)" 'doesn't work
rs.Open Sql, cn
Much appreciated.
PD
Answer : SQL - Dates syntax ( VB6 connecting to SQL Server database)
try this if both requestdate and lastupdate are of datetime type.
'/Sql = Sql & " where requestdate > lastupdate"
Random Solutions
referencing form variables in adp views
WordPerfect 10 hangs when opening some documents.
XP display set to 4 bit color depth after Remote Desktop session
Textboxes in other Tabs in asp.net
Same form on different computers
RUNDLL error message "jyku.fjo" on computer start up
Pass Web Page as Parameter to Class in App_Code Folder
How to create a non-scrolling section (menu) of a web page
VBA - Playing Movies using VLC or GOM Player
Error updating public folder with free-busy information on virtual machine exchange 2003