Hi all,
I'm a bit of a newbie to ASP, so hope this isn't too obvious...essentially I'm querying a very simple Access database from some ASP. The SQL I'm using is very simple, but unfortunately when I add a 'WHERE' clause to it, no data is returned. If I run the same query directly within the database, the query returns a number of rows.
The code that returns data OK is:
The code that returns no data at all is:
Sorry if the code is a bit long-winded, as I say I'm quite new to this game. Basically I've tried various connotations of the where clause - selecting specific fields, messing around with the Chr(34) character etc., but essentially as soon as I stick in the 'WHERE', I get no data on my page!
Any suggestions? Many thanks.
I'm a bit of a newbie to ASP, so hope this isn't too obvious...essentially I'm querying a very simple Access database from some ASP. The SQL I'm using is very simple, but unfortunately when I add a 'WHERE' clause to it, no data is returned. If I run the same query directly within the database, the query returns a number of rows.
The code that returns data OK is:
Code:
Set con = CreateObject("ADODB.Connection")
con.Open "CentralReporting"
Set cmd = CreateObject("ADODB.Command")
Set cmd.ActiveConnection = con
cmd.CommandText = "SELECT Report.ReportName, System.SystemName FROM System INNER JOIN Report ON System.SystemID = Report.SystemID"
Set rs = cmd.Execute()
cmd.CommandText = "Select ReportURL from Report"
Set rs2 = cmd.Execute()
cmd.CommandText = "Select Description from Report"
Set rs3 = cmd.Execute()
dim link(7)
dim iCount
dim iCount2
iCount = 0
iCount2 = 0
for iCount = 1 to 7
link(iCount) = "<a href=" & rs2("ReportURL")& "><h5>" & rs("ReportName") & "</h5></a>" & " <h6> " & rs3("Description") & " </h6>"
rs.movenext
rs2.movenext
rs3.movenext
next
for iCount2 = 1 to 7
response.write (link(iCount2) & "<br>")
next
con.close
The code that returns no data at all is:
Code:
Set con = CreateObject("ADODB.Connection")
con.Open "CentralReporting"
Set cmd = CreateObject("ADODB.Command")
Set cmd.ActiveConnection = con
cmd.CommandText = "SELECT Report.ReportName, System.SystemName FROM System INNER JOIN Report ON System.SystemID = Report.SystemID WHERE Report.ReportName like " & chr(34) & "*" & chr(34)
Set rs = cmd.Execute()
cmd.CommandText = "Select ReportURL from Report"
Set rs2 = cmd.Execute()
cmd.CommandText = "Select Description from Report"
Set rs3 = cmd.Execute()
dim link(7)
dim iCount
dim iCount2
iCount = 0
iCount2 = 0
for iCount = 1 to 7
link(iCount) = "<a href=" & rs2("ReportURL")& "><h5>" & rs("ReportName") & "</h5></a>" & " <h6> " & rs3("Description") & " </h6>"
rs.movenext
rs2.movenext
rs3.movenext
next
for iCount2 = 1 to 7
response.write (link(iCount2) & "<br>")
next
con.close
Sorry if the code is a bit long-winded, as I say I'm quite new to this game. Basically I've tried various connotations of the where clause - selecting specific fields, messing around with the Chr(34) character etc., but essentially as soon as I stick in the 'WHERE', I get no data on my page!
Any suggestions? Many thanks.