Break in ASP Pages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nitindel
    New Member
    • Dec 2007
    • 67

    Break in ASP Pages

    Hi frends,

    I am working on ASP,VBSCRIPT,JA VASCRIPT...

    Suppose if i have an condition in the script and if the condtion fails then i want to break the flow and raise the error .....i mean the below code should not be executed and the page should remain the same.

    Response.end will stop rendering the below page.

    See the below snippet..


    [CODE=asp]dim arrSelect(1)
    arrSelect(0) = "empid"
    dim dbconnCheck
    set dbconnCheck=ser ver.CreateObjec t("dbcom.dbhand ler")
    dbconnCheck.con nect
    dbconnCheck.For mSQLStmt "emp",4,arrSele ct,,"where empid='"&Reques t.Form("employe eid")&"'"
    dbconnCheck.Exe cuteSql
    set empidot = Server.CreateOb ject("Adodb.Rec ordSet")
    set empidot = dbconnCheck.Get Recordset
    if empidot.RecordC ount > 0 then
    Response.Write( "<script>alert( 'No record found')</script>")[/CODE]


    Thanks in Advance
    Nitin Sharma
    Software Engineer
    Last edited by gits; Jan 3 '08, 09:04 AM. Reason: added code tags
  • nitindel
    New Member
    • Dec 2007
    • 67

    #2
    Hi ...friends...
    please tell...
    if a am having a piece of code that checks in the recordset that do not have more than one value..?? if it does have more than one value i.e rs.recordcount > 0 the it should throw an alert

    in the form of like below:

    [CODE=asp]Response.write( "<script> alert('Record already Exists')</script>")
    txtempid.focus
    [/CODE]
    but in the same page the code exists..the alert should not hamper the rest of code.

    thnaks in Advance ..please tell asap

    Nitin Sharma
    Software Engineer
    Last edited by gits; Jan 3 '08, 09:05 AM. Reason: added code tags

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      This should be coded in your ASP page. Why have you posted this in JavaScript?

      Comment

      • nitindel
        New Member
        • Dec 2007
        • 67

        #4
        I have posted on both ASP and Javascript forums....but no reply till yet from any of them..!!

        Thanks & Regards
        Nitin Sharma

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          You have got replies, but not a solution yet.

          This is really an ASP problem. JavaScript is client-side, but the server-side code whether it be ASP or another language can generate code to display. You'll just need an if statement to check the condition and display the JavaScript.

          If you've got a problem in the JavaScript, post the code here.

          Comment

          • nitindel
            New Member
            • Dec 2007
            • 67

            #6
            Thanks to all those who have replied..!!!


            I got the solution as I have used Server.Execute. ..instead response.end and all that stuff...so i thinks its a better way of doing...
            my module is completed henceforth ..
            Thanks to u all once again...

            Nitin Sharma
            Software Engineer

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Glad you got it working though I wasn't able to help and thanks for letting us know.

              Comment

              • nitindel
                New Member
                • Dec 2007
                • 67

                #8
                Originally posted by acoder
                Glad you got it working though I wasn't able to help and thanks for letting us know.
                Thanks a lot............ .....!!! :-)

                Comment

                Working...