Forums
This topic is locked
Empty recordset...
14 Nov 2004 00:40:38 Chriz L. posted:
Hello all, i have this source code
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
sql1="SELECT * FROM Weather WHERE WeatherDate=" + Replace(CDate("7/11/2004", "'", "''" + ""
set rs1 = conn.Execute (sql1)
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
where the date 7/11/2004 exists in the Weather Table (and WeatherDate type is Date) but i'm getting an empty recordset....
Any suggestion what might be wrong?
Thanks in advance!
Replies
Replied 15 Nov 2004 17:09:14
15 Nov 2004 17:09:14 myke black replied:
try putting the date inside # characters (only works for MS Access) or you could try swapping the month and days around so it says:
sql1="SELECT * FROM Weather WHERE WeatherDate=" & Replace(CDate("11/7/2004", "'", "''" & ""
Quite often the ASP parser uses the american date format even though the system settings are in uk format (and vice versa) - to lock down what date formats are being used, you could add session.LCID=XXXX at the top of the page - for more info on locales, refer to support.microsoft.com/kb/q229690/
If that fails, you should try response.write(sql1) after the first line of code to see what exactly the database query is, then run that query directly in the database to see if it is actually returning 0 records, or if there is a syntax error in the query.
Edited by - mykeblack on 15 Nov 2004 17:10:23
sql1="SELECT * FROM Weather WHERE WeatherDate=" & Replace(CDate("11/7/2004", "'", "''" & ""
Quite often the ASP parser uses the american date format even though the system settings are in uk format (and vice versa) - to lock down what date formats are being used, you could add session.LCID=XXXX at the top of the page - for more info on locales, refer to support.microsoft.com/kb/q229690/
If that fails, you should try response.write(sql1) after the first line of code to see what exactly the database query is, then run that query directly in the database to see if it is actually returning 0 records, or if there is a syntax error in the query.
Edited by - mykeblack on 15 Nov 2004 17:10:23