Trapping ADO Connection Errors

From: DavidM (spam_at_spam.net)
Date: 12/28/04


Date: Tue, 28 Dec 2004 16:11:47 -0600

I have a VB6 application that uses ADO to communicate with SQL Server 2000.
The application works fine, however I seem to have issues with trapping
connection errors with ADO.

I have a basic Error Handler in all my functions and display both VB and ADO
errors when they occur -- however, the problem I seem to be having is this:

1) I create ADO Connection object and successfully log into SQL Server. No
problems.

2) I can create Recordset objects using Connection objects to perform
various operations on my database.

3) However, if I disconnect my network cable or disconnect my VPN connection
to work while my application is idle doing nothing, and then attempt to
perform a database operation... I normally get a slew of errors... some of
which seem to get hung in a loop.

Some of the errors are from when I try to open a recordset connection within
a With block or whatever other commands try and use an ADO command after the
connection is lost.

What is the best way to handle this?

Also, I currently display on the status bar "Connected" after a user
successfully logins in an my ADO Connection object is created. I would like
to dynamically change this to "Disconnected" when I can no longer
communicate with database.

I assume, if this happens, I will have to have a way for the user to attempt
to log back into the application and re-create the connection object atain.

Anyone know the best way to handle this?



Relevant Pages

  • Re: Sql Server 2000 slow
    ... If I close the connection (moving the Open/Close ... ADO) and the dll gives twice the performance. ... > Are there any known performance issues with .NET accessing Sql Server ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Cross Transactions between ADO & ADO.Net
    ... MARS session pool limited to one connection?). ... > There is one thing that might help here, if you're using SQL Server. ... We even call ADO code from ... >> the DTC cordinator from COM+ to handle the transactions between ADO.Net ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: absolute newbie question - connecting to SQL server in ADO.net
    ... How do I get the above connection working? ... > experience of ADO prior to this was in Access 2000. ... Have I wasted my money buying VB.net standard because it can't connect to ... > an SQL server 2000 server? ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Connection issues with ADO
    ... >With ADO 2.5 the default connection protocol was named pipes. ... I can always use Named Pipes to connect to my local sql server. ...
    (microsoft.public.vb.general.discussion)
  • Re: Trapping ADO Connection Errors
    ... classes for the database function, common methods, one long procedure. ... Are you aware of the Error collection used by ADO: ... > 1) I create ADO Connection object and successfully log into SQL Server. ...
    (microsoft.public.vb.general.discussion)