Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access ADO error trapping

Status
Not open for further replies.

aaronvegh

Technical User
Apr 12, 2001
3
0
0
Hi there,
I'm forced to use Access to serve a database for a large-ish site. Predicably, we're getting server errors that look like this:

Microsoft OLE DB
> Provider for ODBC Drivers error '8007000e' , ,
> [Microsoft][ODBC Microsoft Access Driver] System resource
> exceeded. , ,
> /foo.asp, line 441

Line 441 in this reference is the last line of this bit of code:

SqlJunk = "SELECT * from content where item_id="&id&" order by subcategory"
Set rsGlobalWeb = Server.CreateObject("ADODB.Recordset")
rsGlobalWeb.Open SqlJunk, dbGlobalWeb, 3

So my question is, how would I trap that last line, check it for a returned error and take alternative action in that case?

Thanks for your help!
Aaron.
 
Try something like the following. Errors are trapped on the connection object. Assume connection is objConn.

rsGlobalWeb.Open SqlJunk, objConn, 3, 3
If objConn.Errors.Count > 0 then
<%
for each objErr in objConn
response.write(&quot;<p>&quot;)
response.write(&quot;Description: &quot;)
response.write(objErr.Description & &quot;<br />&quot;)
response.write(&quot;Help context: &quot;)
response.write(objErr.HelpContext & &quot;<br />&quot;)
response.write(&quot;Help file: &quot;)
response.write(objErr.HelpFile & &quot;<br />&quot;)
response.write(&quot;Native error: &quot;)
response.write(objErr.NativeError & &quot;<br />&quot;)
response.write(&quot;Error number: &quot;)
response.write(objErr.Number & &quot;<br />&quot;)
response.write(&quot;Error source: &quot;)
response.write(objErr.Source & &quot;<br />&quot;)
response.write(&quot;SQL state: &quot;)
response.write(objErr.SQLState & &quot;<br />&quot;)
response.write(&quot;</p>&quot;)
next
%>
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top