Solved

Detecting Errors while using ADO

Posted on 1998-12-22
1
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

728 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