Sql server login prompt

G

Guest

Is it possible to prevent that the 'sql server login'-prompt will be shown
when it's not possible to make a connection to the database?

It is not our purpose that our users know the userid and password. When
they can't make a connection to the database they have to restart the
application (excel-file) or press our refresh connection-state button. I
just want to show a messagebox 'Could not make a connection to the database'
instead of the 'sql server login'-prompt.

Does someone know if it is or how it's possible?

TIA,


Isabel
 
T

tony h

Some clarification from you would be helpful as to how you are accessing
the SQL database.

From your comments I guess you are setting up a connecting on startup
and have a refresh connection button but that the code can terminate
and so you lose your connection.

In this situation if you test the connection or database object eg:

if cnn is nothing then do_the_reconnection_code

Although this should work it does imply that you are not closing
objects properly. To manage this Set up a class object to handle the
connection and other database objects. Then define a global variable AS
NEW myCLASS.

The advantage of thios is that you can automatically manage the opening
and closing of the connection through the class initialise and class
terminate events.

If you want help on this post again - or I have posted similar
responses before.

hope this helps.

regards
 

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