GBASE南大通用分享
获得当前数据库的名字或在连接打开后使用的数据库名字。
语法
[Visual Basic]
Public Overrides ReadOnly Property Database As String
Get
[C#]
public override string Database { get; }
实现
IDbConnection.Database
注释
Database 属性不能动态更新,如果用户想改变数据库可以使用ChangeDatabase 方法改变当前数据库,此时这个属性会变为新的数据库值。
示例
下面的例子创建了一个 GBaseConnection 并且显示了它的一些只读属性。
[Visual Basic]
Public Sub CreateGBaseConnection()
Dim gsConnString As String = _
"Persist SecurityInfo=False;
database=test;server=localhost;"_
&"user id=joeuser;pwd=pass;pooling=false"
Dim gsConnection As New GBaseConnection( gsConnString )
gsConnection.Open()
MessageBox.Show( "Server Version: " +
gsConnection.ServerVersion _
+ ControlChars.NewLine + "Database: " +_
gsConnection.Database )
gsConnection.ChangeDatabase( "test2" )
MessageBox.Show( "ServerVersion: " +
gsConnection.ServerVersion _
+ ControlChars.NewLine + "Database: " +_
gsConnection.Database )
gsConnection.Close()
End Sub
[C#]
public void CreateGBaseConnection()
{
string gsConnString = "Persist Security
Info=False;database=test;server=localhost;user
id=joeuser;pwd=pass;pooling=false";
GBaseConnection gsConnection = new
GBaseConnection( gsConnString );
gsConnection.Open();
MessageBox.Show( "Server Version: " +
gsConnection.ServerVersion + "\nDatabase: " + gsConnection.Database );
gsConnection.ChangeDatabase( "test2" );
MessageBox.Show( "ServerVersion: " +
gsConnection.ServerVersion + "\nDatabase: " + gsConnection.Database );
gsConnection.Close();
}