Link to home
Start Free TrialLog in
Avatar of running32
running32

asked on

Exit server side script on ASP page

I need to validate that there are records returned.  If not I need to exit the sever side script and display an alert box on the aspx.net page.   How can I do this please.  I do not want to use response.write I need the user to be alerted to the fact that there is no info for them.

Thanks

If objRdr.Read() Then
       Response.Write(objRdr(0))
    Else
       response.Write("NO RECORDS RETURNED")
    End If  
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Try:

    If objRdr.Read() Then
       Response.Write(objRdr(0))
       Response.Write("<script language=""javascript"">alert('NO RECORDS RETURNED');</script>"
       Response.Flush()
    Else
       response.Write("NO RECORDS RETURNED")
    End If  
Avatar of running32
running32

ASKER

Nope that's not it.  The page give the error no End if.  
Does it say where ? It shouldn't be for that block.
If I take out the Response.Write("<script language=""javascript"">alert('NO RECORDS RETURNED');</script>" the page is ok again.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial