Newbie: SQL Server Access returned string (?)

S

steve

Hi,

I have a VB.NET application that is accessing an SQL server Database.
Is there a string(code) that the server can return that I can read and tell
wether :
1)the server is down
2)the user is not allowed
3) everything is OK

TIA
-steve
 
M

Mike Epprecht \(SQL MVP\)

Hi

Why don't you simulate those scenarios and see what errors come back?
You could have about a matrix of 25 different errors, depending on factors
as object permissions, login password failures, server off, DNS not working
etc

Cheers
--------------------------------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: (e-mail address removed)

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/
 
J

JT

I think there is a State property of the Connection object that will confirm
if you successfully connected. In addition to that, you could execute the
following query:

select @@SPID as SPID

If SPID > 0, then you know the server is up, you are logged in, and know
your current server process ID.

As far as knowing if "everything is OK", that is a bit too vague. If your
database is not normalized or last night's backup failed, then everything is
not OK.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top