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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Test Connection at RunTime? 1

Status
Not open for further replies.

pokermat

Programmer
Jan 17, 2002
44
GB
Hello

I have an app which uses several connections within the Data Environment. On loading, the Connection Strings for the connections are read from an .ini file. The idea being that if one server is down there is an alternative server in the ini file.

At design time you can click 'Test Connection' - does anyone know of a way of doing the same thing at run time?

Simply opening the connection (using a bad server name) brings up the Sql Server Login screen which is something I would like to avoid - I would prefer it if the users saw nothing.

Any ideas gratefully received...
 
Hi,

This works fine for me (no SQL server login screen)

-----------------------------------------------------------
Dim Conn As Connection
On Error GoTo ErrHndl:

Set Conn = New Connection
Conn.Open "Provider=SQLOLEDB;Password=webaccess;Persist Security Info=True;User ID=web;Initial Catalog=Bath;Data Source=Blahblah;Network Library=dbmssocn"

Conn.Close
Exit Sub
ErrHndl:
MsgBox Err.Description
-----------------------------------------------------------
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top