How to display five rows only from 50 rows table?

  • Thread starter Pingwin via AccessMonster.com
  • Start date
P

Pingwin via AccessMonster.com

How to display only rows where "ArtNumber" is bigger then "0".

Here is the coding...

<%
Dim cn
Dim rs
Dim cnStr
cnStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath
("myArticles.mdb") & ";"
Set cn = Server.CreateObject("ADODB.Connection")
cn.ConnectionString = cnStr
cn.Open
Set rs = cn.Execute("SELECT * FROM tblArticles ORDER BY ArtNumber")
Do While Not rs.EOF
Response.Write("<tr>")
Response.Write("<td>" & rs.Fields("ArtNumber") & "</td>")
Response.Write("<td>" & rs.Fields("Title") & "</td>")
Response.Write("<td>" & rs.Fields("Article") & "</td>")
Response.Write("</tr>")
rs.MoveNext
Loop
Set rs = Nothing
cn.Close
Set cn = Nothing
%>

If anyone could help....I would greatly appreciate it.
 
D

Douglas J. Steele

Set rs = cn.Execute("SELECT * FROM tblArticles WHERE ArtNumber > 0 ORDER BY
ArtNumber")

or, if ArtNumber is text, then

Set rs = cn.Execute("SELECT * FROM tblArticles WHERE ArtNumber > "0" ORDER
BY ArtNumber")
 
P

Pingwin via AccessMonster.com

Hi Douglas,
It works like a dream. Thank you very much.
Regards,
Pingwin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top