determine if database connection is open

G

geebee

i have the following code snipet in my database:

' Set the string to the path of your database
strDB = "C:\folder\subfolder\database_name"

cnt.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDB & ";"


However, I am getting error messages that say something like "database has
been put in admin state by xyz."

i would like for the preceding code to be carried out ONLY if the database
connection has NOT been established. How can I change the code o achieve
this?

Thanks in advance,
geebee
 
P

Phillip Windell

geebee said:
i have the following code snipet in my database:

' Set the string to the path of your database
strDB = "C:\folder\subfolder\database_name"

cnt.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDB & ";"

After opening and using the connection,..you need to close it as soon as you
no longer need it to be open anymore....

"cnt.Close"

....so that the next time you try to open it you won't find it "already
open".

Of course things can vary with different situations and different
deployments,..so that is the best I can tell you with not knowing anything
about what you are doing. Most of my experience with it is with an ASP
front-end / MDB File back-end.
 

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