by GaryVass » Thu May 16, 2013 1:19 pm
Ok, back to an old issue here....
I have found that I can not filter based on datevalues in mysql (at least my sql statements never do )... so I figured I would convert all my date in mysql to serial date values, then run my sql queries based on those.
I need to go the the highest date value then move back day by day. ie, serialdate - 1.
In Q7basic, I am having trouble converting my dates (sdteTo dim'd as Date) to serial dates. I have the following code where I convert portions of sdteTo to date interger values to use in the DateSerial function.... however, it does not like the conversion lines tYear = Year(sdteTo)???? The tYear, tMonth, tDay are dim'd as Integers, sdteTo as Date... (currently working in Linux).
If chkDate = 1 Then sdteTo = tCurdate
tYear = Year(sdteTo)
tDay = Day(sdteTo)
tMonth = Month(sdteTo)
strSql = "SELECT * FROM prices WHERE TICKER = '" & findit & "', DATE = '" & sdteTo & "' ORDER by DATE DESC;"
sRecordsId = Records.Open(gsDatabase, strSql)
rslt = Records.First(sRecordsId)
If rslt <> True Then
tDateChange = -1
tSerialDate = DateSerial(tYear, tMonth, tDay)
sdteTo = DateAdd("d", tDateChange, sdteTo)
strSql = "SELECT * FROM prices WHERE TICKER = '" & findit & "', DATE = '" & sdteTo & "' ORDER by DATE DESC;"
sRecordsId = Records.Open(gsDatabase, strSql)
rslt = Records.First(sRecordsId)
End If