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

Open SQL and return an object pObj_DB 1

Status
Not open for further replies.

AgatheB

Programmer
Jan 16, 2003
36
DK
Hi!

I have to adjust all my code from using Access to using SQL server (connecting with ADO). In the original situation I would open the base by setting pObj_DB = OpenDatabase(DBNam, DBExcl, DBReadOnly, Connect_str). I use pobj_db through my entire code in small functions (opening, deleting, altering, etc.), where i get the database name, and in that way check if the base is open.
How can I get an object from my ado connection? I use:
Set pConnSQL = New ADODB.Connection
pConnSQL.ConnectionString = Connect_str
pConnSQL.Open
Now I can't get a name nor value from pConnSQL. I found out that Print pConnSQL.ConnectionString returns a value which is different depending the status of the base:
open gives this string: Provider=SQLOLEDB.1;Password=sa;User ID=sa, etc., etc.
closed gives this string:
Provider=SQLOLEDB;Data Source=LATITUDE_99; etc., etc.
Now here's my FINAL question:
Can I use this string to check if my base is open?
So if sqloledb has ';' of '.1' behind it?
Help! Any suggestion is welcome.

Agathe
 
The connection object should have Status property wich tells you if that connection object it's already conected or something.
wordobj.Status

________
George, M
 
You're right, It's called .state.

Thankz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top