Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I tell an asp script to end or terminate, plz help.

Status
Not open for further replies.

taval

Programmer
Jul 19, 2000
192
GB
I have an asp script which has a Select Case block of code and some &quot;other&quot; code after it.<br><br>Here's an extract of my code:<br><br>----------------------------------------------<br><br>&nbsp;&lt;html&gt;<br>&lt;head&gt;<br>&lt;title&gt;Database Test&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;% <br>Dim rs<br>Dim StrQuery<br>Dim strAction<br>Dim strSQL<br>Dim rsFileDesc<br><br>strAction = Request.Form(&quot;button&quot;)<br><br>Select Case strAction<br><br>Case &quot;Search ID&quot;<br><br>StrQuery = &quot;Select * from Customer where CustID = &quot; & Cint(Request(&quot;CustID&quot;))& &quot;&quot;<br><br>Case &quot;Search Name&quot;<br><br>StrQuery = &quot;Select * from Customer where CustName = &quot; & &quot;'&quot; & Request(&quot;CustName&quot;)& &quot;'&quot;<br><br>Case &quot;Search Query&quot;<br><br>StrQuery = &quot;Select * from Customer&quot;<br><br>Case &quot;List All Customers&quot;<br><br>Set rs = Server.CreateObject (&quot;ADODB.Recordset&quot;)<br>rs.Open StrQuery ,&quot;DSN=Architron; UID=sa; PWD=&quot;<br><br>if Not rs.EOF then<br>rs.movefirst<br>While Not rs.EOF<br>Response.Write &quot;Customer ID: &quot; & rs(&quot;CustID&quot;)& &quot;&lt;br&gt;&quot;<br>Response.Write &quot;Customer Name : &quot; & rs(&quot;CustName&quot;) & &quot;&lt;br&gt;&quot;<br>Response.Write &quot;Phone: &quot; & rs(&quot;Phone&quot;) & &quot;&lt;br&gt;&quot;<br>Response.Write &quot;Fax: &quot; & rs(&quot;Fax&quot;) & &quot;&lt;br&gt;&quot;<br>Response.Write &quot;E-mail: &quot; & rs(&quot;email&quot;) & &quot;&lt;br&gt;&quot;<br>Response.Write &quot;Space Allocated (MB) : &quot; & rs(&quot;SpaceAllocationInMB&quot;) & &quot;&lt;br&gt;&quot;<br>Response.Write &quot;Space Used: &quot; & rs(&quot;SpaceUsed&quot;) & &quot;&lt;br&gt;&quot;<br>Response.Write &quot;&lt;br&gt;&quot;<br>rs.MoveNext<br>Wend<br><br>else<br>end if<br>&lt;------ want to terminate here ------------&gt;<br><br>Case &quot;another case&quot;<br><br>End select<br><br>&lt;------ &quot;other&quot; code -------&gt;<br><br>Set rs = Server.CreateObject (&quot;ADODB.Recordset&quot;)<br>rs.Open StrQuery ,&quot;DSN=Architron; UID=sa; PWD=&quot;<br><br>-----------------------------------------------<br><br>The case &quot;List All Customer&quot; has code in it which I want to process, I then want the asp script to stop or end so that it does not execute code any other code afterwards. Any help appreciated.<br><br>Taha
 
you could do at the top<br>Response.Buffer = True<br><br>then use Response.Flush to send the info in the buffer to the client, or if an error occurs you can use Response.redirect to change the URL (only works if buffer is true, and no info was sent to the client) you can possibly use a Goto , and set a area down at the bottom to goto. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
Response.End will stop processing of a script.<br>If you use response.redirect, be sure to put a response.end after it, otherwise the script will process till the end, then redirect. <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
I think Response.end is better option.<br><br>I can see amny other problem in code. Remove 'if rs.eof the else end if'&nbsp;&nbsp;because in while condition you are checking the same.<br><br>Anand
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top