This topic is locked

Redirect when no records found

3/1/2010 12:03:20 PM
ASPRunnerPro General questions
H
huffharper author

I have before SQL on _ list.asp
strWhereClause = whereAdd(strWhereClause, "name= '" & session("UserID") & "'")
If no records are found I want to redirect to another page.
Thanks
Huff

F
FunkDaddy 3/17/2010

Huff,
I am looking for the same exact answer. I used a Before SQL event to filter records according to a user $_SESSION["UserID"] and sometimes users come up short (aka "blank page"). I tried adding some IF statement logic to at least print out a message on screen such as "No records found" but because the page is blank it can't check againt any values or fields to determine if the IF statement is true or false.
Anyhow, if you find the answer please post it here - I'll do the same.
Best,

Sergey Kornilov admin 3/17/2010

The idea here is to execute query manually. If query doesn't return any records you can either redirect user to another page (Huff) or display a message on the page (FunkDaddy).