Home > ASP Development > Testing a MS SQl connection

Testing a MS SQl connection



If I have 2 MS SQL Databases, one as Production and the other as Backup. The Production updates the data on the Backup. WHat I want to do is to test the the Production database is still online and if not I want to change the connection string to point to the Backup. I want to this via ASP.

    
Guest


Just use an if statement to determine if you can connect to the production server, if not, then connect to the backup.

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by Memnoch
Just use an if statement to determine if you can connect to the production server, if not, then connect to the backup.




sorry to hijack this thread...but this message is to Memnoch...



Memnoch..i was just wondering if you had a chance to look at my pm and the post i referred to ...



thanks for your time

Was this answer helpful ? Yes No   
Guest


I am a bit of a newbie. If I open a connection foe example conn.open conn_string



How would I use the 'if statement' to test if the connection was a success or not.



Thanks



Quote:
Originally Posted by Memnoch
Just use an if statement to determine if you can connect to the production server, if not, then connect to the backup.

Was this answer helpful ? Yes No   
Guest


Example:


Code:



Set Conn = Server.CreateObject("ADODB.Connection")

ConnectionString1 = "Your Production ConnectionString"
ConnectionString2 = "Your Backup ConnectionString"

Conn.Open ConnectionString1

If Conn.State = 0 Then
The connection couldn't be opened
Conn.Open ConnectionString2
End If



Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved