469,600 Members | 2,367 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,600 developers. It's quick & easy.

testing a connection string

Sam
Hi,
From my vb.net application I want to test a connection to a server and

a database, given a user name, password, server name and database name.
What is the best way to test if the connection string is valid or not ?
Would a connection to the Master DB be enough to say it is valid or not
?

Thx

Jul 23 '05 #1
3 2119
That's probably the only way - only the server 'knows' if the login
and password are valid, if the database exists and is available etc.
You could just put it in a try/catch block to test it.

Simon

Jul 23 '05 #2

Sam wrote:
Hi,
From my vb.net application I want to test a connection to a server
and a database, given a user name, password, server name and database name. What is the best way to test if the connection string is valid or not ? Would a connection to the Master DB be enough to say it is valid or not ?

Thx


If you've been given username, password, server and database, why not
connect to that database?

Jul 23 '05 #3
Sam
Actually, my question was, what is the minimum to know whether my
connection string is valid or not... I guess if conn.Open works then
that's enough ;)
thx

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Scott B | last post: by
2 posts views Thread by Naveen Mukkelli | last post: by
72 posts views Thread by Jacob | last post: by
reply views Thread by Alexnb | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.