Getting Started Common Acronyms FAQ Forum Help Forum Tips FTP Site Helpful Guidelines Product Community Directory SELECTsupport
Great thanks to all of you!
It works by using:
CadInputQueue.SendCommand ("db=?")
CurrentDBConn = MicroStationDGN.MessageCenter.GetMessage(0).Message
Regards
Rói
Rói,
And Jon is correct in that the MicroStation (and thus Bentley PowerMap) database connection information is not available.
Depending on your application requirements, you may be able to use the BUDBC (Bentley Universal Database Connection) which is basically a COM object that encapsulates access to OLEDB, ODBC and Oracle database sources and supports multiple connections, with the first being used by MicroStation.
Regards,
Jeff Bielefeld [Bentley]
Not a VBA specific solution, but the keyin DB= will reveal the current connection or status in the MicroStation familly of applications. It can also be used to specify or switch to another connection.
From the ground up, the database connection manager, connection type, and db connection can all be specified via keyin. The routine would be:
mdl load dbconmgr
dbconmgr=odbc
db=mytown
Where 'mytown' = the ODBC DSN.
an Oracle connection would be spec'd as:
db=user/pass@host
Rói: Can someone please tell me, how VBA can find out which database connection is currently active in PowerMap?
MicroStation's DB interface is notoriously obscure. AFAIK it's not possible to query MicroStation for its current DB connection (I'd love to be proved wrong).
The nearest you can get is the tcb->schema member of the TCB. MicroStation's DB connector writes the data source name to that location when it first connects. However, the TCB belongs to a DGN file, and if you open another DGN file that information is lost.
Rói: I use Oledb to connect to the database. The sources are saved in two UDL files, one called "GIS" and the other "SIK". How can VBA see, which connection is active, and is it possible to switch current DB user from VBA?
Using ADO you can do what you want for your own VBA application, but unfortunately that's doesn't affect MicroStation's DB connections. Again, I'd love to be proved wrong.
Regards, Jon Summers LA Solutions
Hi
Can someone please tell me, how VBA can find out which database connection is currently active in PowerMap?
I use Oledb to connect to the database. The sources are saved in two UDL files, one called "GIS" and the other "SIK". How can VBA see, which connection is active, and is it possible to switch current DB user from VBA?
Thanks
Rói Højgaard