Solved

Detecting Errors while using ADO

Posted on 1998-12-22
1
166 Views
Last Modified: 2013-12-25
I have checked many ASP books, including the "Programming Active Server Pages" from MS.  They all talk about how to use the ADODB Connection object and the recordset object to get or update data.  None of these books talk about how to detect any errors.  For example, I am inserting multiple records into an Access table.  Since the records have the same values, I should get some sort of errors from somewhere and remind the user to change the data.  How could I get that error?
0
Comment
Question by:akhaligh
1 Comment
 
LVL 6

Accepted Solution

by:
PBall earned 50 total points
Comment Utility
at any point before executing the command, you can do the following:

-- I suggest you put your routine in a sub / function to isolate the problem locally.

Sub getRecords

   Dim rs

   On Error Resume Next   'trap for error

   Set rs = Server.CreateObject("ADODB.Recordset")

   rs.Open "getRecords",strConnection,adOpenForwardOnly,adLockReadOnly,adCmdStoredProc

   'if for some reason, the previous command fails, do this...

   If Err.Number > 0 Then
     Response.Write "Error getting record"
     Err.Clear
   End If


   On Error Goto 0  'disable error trap

End Sub
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The viewer will learn how to dynamically set the form action using jQuery.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

771 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

10 Experts available now in Live!

Get 1:1 Help Now