Solved

Detecting Errors while using ADO

Posted on 1998-12-22
1
168 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
ID: 1857435
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
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…

776 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