GBASE南大通用Connection 属性

获取或设置GBASE南大通用 Command 实例使用的 GBaseConnection 对象。

 语法

[Visual Basic]

Public Property Connection As GBaseConnection

Get

Set

[C#]

public GBaseConnection Connection { get; set; }

 注释

GBASE南大通用当事务在进行中且 Transaction 属性为空时,如果用户设置了 Connection,

那么会产生 InvalidOperationException。如果 Transaction 属性不是 null 且

事务已经提交或者回滚了,Transaction 将被自动设置为 null。

 示例

下面的例子创建了 GBaseCommand 且设置了它的一些属性。

[Visual Basic]

Public Sub CreateGBaseCommand()

Dim gsSelectQuery As String="SELECT * FROM gstable ORDER BY id"

Dim gsConnectString As String = "Persist SecurityInfo=False; "_

& "database=test; "_

& "servser=gsServer"

Dim gsCommand As New GBaseCommand(gsSelectQuery)

gsCommand.Connection = New GBaseConnection(gsConnectString)

gsCommand.CommandType = CommandType.Text

End Sub

[C#]

public void CreateGBaseCommand()

{

string gsSelectQuery = "SELECT * FROM gstable ORDER BY id";

string gsConnectString = "Persist

SecurityInfo=False;database=test;

server = gsServer";

GBaseCommand gsCommand = new GBaseCommand(gsSelectQuery);

gsCommand.Connection = new GBaseConnection(gsConnectString);

gsCommand.CommandType = CommandType.Text;

}

你可能感兴趣的:(数据库,GBASE南大通用,GBASE)