June 18th, 2012, 05:30 PM
Conditional Statement Not Working...
What's wrong with this syntax?
I am not getting an error, but this is what it outputs:
saleid = Request.QueryString("saleid")
set conn = server.CreateObject ("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("users.mdb")
set rs = server.CreateObject ("ADODB.Recordset")
rs.open "SELECT * FROM Sales ", conn, 3,3
do while not rs.EOF
If rs.Fields("id") = saleid then
set rs = nothing
set conn = nothing
You can see that saleid DOES equal rs.fields("id") for the first field in database.
June 18th, 2012, 06:27 PM
You could include some line breaks in your debug outputs to help you see where things are going wrong.
As a comment, selecting all the records from your DB then filtering them in a loop is kind of an unnecessary step and wastes resources. Also imagine how your page will run when you have a couple million sales records.
I'd add a WHERE clause in your sql so you get back a recordset with only what you want.
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi