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
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