Forum Moderators: open

Message Too Old, No Replies

Help needed on this code

Help needed on this code

         

lindajames

11:59 am on Mar 24, 2003 (gmt 0)

10+ Year Member



I have the following code below. It basically checks my database for the hits on my page in order of highest number of hits. Basically, when i run the script i get alot of countries that dont have hits (0). Can anyone tell me how i can actually tell the script to only display the ones with a value above 0?

<%
Dim rs, strSQL, cn

cn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &server.mappath("data.mdb")
strSQL="SELECT * FROM Country ORDER BY GEO_Hits DESC, GEO_Country ASC"

set rs=Server.CreateObject("ADODB.Recordset")
rs.open strSQL, cn

if not rs.eof then
response.write "<table>"

response.write "<tr>"
response.write "<td><b><u>COUNTRY</u></b><br></td>"
response.write "<td><b><u>HITS</u></b><br></td>"
response.write "</tr>"

do until rs.eof
response.write "<tr>"
response.write "<td> " & rs("GEO_Country") & "</td>"
response.write "<td align='center'>" & rs("GEO_Hits") & "</td>"
response.write "</tr>"

rs.movenext
loop

response.write "</table>"
else
response.write "No Data Found!"
end if

rs.close
set rs=Nothing
%>

I would be very greatful if someone can help me

Cheers
Linda

wardbekker

12:19 pm on Mar 24, 2003 (gmt 0)

10+ Year Member



lindajames,

SELECT * FROM Country WHERE GEO_Hist IS NOT NULL ORDER BY GEO_Hits DESC, GEO_Country ASC

lindajames

12:28 pm on Mar 24, 2003 (gmt 0)

10+ Year Member



hey wardbekker,

i tried that, but now i am getting this error:

Microsoft JET Database Engine error '80040e10'

No value given for one or more required parameters.

Birdman

12:28 pm on Mar 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or...

SELECT * FROM Country WHERE GEO_Hist > 0 ORDER BY GEO_Hits DESC, GEO_Country ASC

lindajames

12:30 pm on Mar 24, 2003 (gmt 0)

10+ Year Member



hey birdman, thats working, but im getting an error on the top of the page saying the following:

error '80020009'
Exception occurred.

lindajames

12:36 pm on Mar 24, 2003 (gmt 0)

10+ Year Member



actually, sorry about that it was my mistake. its working now.

cheers