Home > ASP Development > Checking for Errors

Checking for Errors



Morning Everyone!!



I got what I hope is a simple answer.



Below is part of a code that I need help with. What this code does is it picks up some other data based on the itemnumber the customer has entered. The problem is if the customer enters in a number and that number is not in the database, it errors the script out. Can someone tell me how to set it up that if the itemnumber that the customer has entered is not valid some how flag it for a wrong number??




Code:




If Session("i1") = "" Then
Else
Dim ticket1, sql1
Set ticket1 = Server.CreateObject("ADODB.Recordset")
sql1 = "SELECT * FROM inven WHERE itemnum = '" & Session("i1") & "' ;"
ticket1.Open sql1, db, adOpenForwardOnly, adLockOptimistic

Session("d1") = ticket1("disc")


ticket1.Close
end if




    
Guest


Sorry, I figured it out!

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by webtechmn
Sorry, I figured it out!
Humble suggestion to you. When you find the answer please post it here so that it can be useful for the others who face the same problem

Was this answer helpful ? Yes No   
Guest


Answer:


Code:


If Session("i1") = "" Then
Else
Dim ticket1, sql1
Set ticket1 = Server.CreateObject("ADODB.Recordset")
sql1 = "SELECT * FROM inven WHERE itemnum = '" & Session("i1") & "' ;"
ticket1.Open sql1, db, adOpenForwardOnly, adLockOptimistic
if ticket1.eof then
ticket1.close
Session("win1") = Session("i1")
Session("awin") = True
Session.Contents.Remove("q1")
Else
Session("d1") = ticket1("disc")
ticket1.Close
end if
end if






Quote:
Originally Posted by barneybabe
Humble suggestion to you. When you find the answer please post it here so that it can be useful for the others who face the same problem

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved