Method
Returns information about whether or not a database is open, and if
it is open, returns its name.
Category
Database
Syntax
Function GetDatabaseName(ByRef DatabaseName As String) As
Boolean
DatabaseName
The name of the database, if a database is open.
Example
'Testing functions connectserver, servername or
'databasename, getdatabasename, opendatabase
If .Text1(cf.ServerName) <> "" Then
CF1.ConnectServer .Text1(cf.ServerName).Text, "tcp" '
logWr "Connected to Server"
Else
'Open database
tmpLong = 2000 'cache size
tmpLong2 = 0 'commitcache or not
FunctionInput = .Text1(cf.DatabaseName).Text
If CF1.GetDatabaseName(FunctionInput) Then
logWr "GetDatabaseName with closed DB failed"
End
Else
logWr "GetDatabaseName with closed DB: OK"
End If
CF1.openDatabase .Text1(cf.DatabaseName).Text, tmpLong, tmpLong2
If CF1.GetDatabaseName(FunctionInput) Then
logWr "GetDatabaseName with open DB: OK"
Else
logWr "GetDatabaseName with open DB failed"
End
End If
logWr "Database Opened"
End If
Comments
GetDatabaseName is used with OpenDatabase, ConnectServer or ConnectServerandOpenDatabase
before opening a database to test if it is already open.