Solved

Exit server side script on ASP page

Posted on 2006-07-12
5
193 Views
Last Modified: 2008-03-06
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  
0
Comment
Question by:running32
  • 3
  • 2
5 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17092244
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
 

Author Comment

by:running32
ID: 17092379
Nope that's not it.  The page give the error no End if.  
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17093388
Does it say where ? It shouldn't be for that block.
0
 

Author Comment

by:running32
ID: 17094591
If I take out the Response.Write("<script language=""javascript"">alert('NO RECORDS RETURNED');</script>" the page is ok again.

Thanks
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 17094618
Oh, its missing the closing bracket:

     Response.Write("<script language=""javascript"">alert('NO RECORDS RETURNED');</script>")
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now