SqlConnection error handling

  • Thread starter Thread starter Ryan
  • Start date Start date
R

Ryan

Using VS 2005, I created data adapters using the IDE. I store a
connection object in My.Settings (cool feature) collection. What I'd
like to do is seemlessly changed my connection on the fly. Say for
instance the production server is down due to network or server hang,
the applicaiton should start writing to its own instance of SQL
server. I wanted to use the StatusChanged event but its not firing on
the Fill method. Each time I instantiate my adapter in a routine, I
set the connection to the one in My.Settings because the connection
might be different (local, production, development). It was firing at
one time but hasn't done it since. Don't know what I did to deserve
that. Any help would be greatly appreciated

Thanks in advance,

Ryan
 
I would catch the exception thrown from the first server timing out, and
then change the connection to the local and try to connect again. Watch for
an exception and show message to user if the second fails.
 
Investigate SQL Server 2005 Failover Partner.
http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/implappfailover.mspx

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
Investigate SQL Server 2005 Failover Partner.http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/implapp...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speakerwww.betav.com/blog/billvawww.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visitwww.hitchhikerguides.netto get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
---------------------------------------------------------------------------­--------------------------------------------







- Show quoted text -

Bill,

Is the database mirror failover only isolated to SQL 2005 instances or
is it part of the 2.0 framework? I see its provider based but would
this work with SQL 2000 instances?
 
This is tightly coupled and implemented by SQL Server 2005 (SP1). Nope, it
does not work with 2000.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Investigate SQL Server 2005 Failover
Partner.http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/implapp...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speakerwww.betav.com/blog/billvawww.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visitwww.hitchhikerguides.netto get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
---------------------------------------------------------------------------­--------------------------------------------







- Show quoted text -

Bill,

Is the database mirror failover only isolated to SQL 2005 instances or
is it part of the 2.0 framework? I see its provider based but would
this work with SQL 2000 instances?
 
Back
Top