Solved

Detecting Errors while using ADO

Posted on 1998-12-22
1
169 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

820 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