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  
running32Asked:
Who is Participating?
 
Carl TawnConnect With a Mentor Systems and Integration DeveloperCommented:
Oh, its missing the closing bracket:

     Response.Write("<script language=""javascript"">alert('NO RECORDS RETURNED');</script>")
0
 
Carl TawnSystems and Integration DeveloperCommented:
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  
0
 
running32Author Commented:
Nope that's not it.  The page give the error no End if.  
0
 
Carl TawnSystems and Integration DeveloperCommented:
Does it say where ? It shouldn't be for that block.
0
 
running32Author Commented:
If I take out the Response.Write("<script language=""javascript"">alert('NO RECORDS RETURNED');</script>" the page is ok again.

Thanks
0
All Courses

From novice to tech pro — start learning today.