暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

GBASE南大通用Connection 属性

原创 淮海路小佩奇 2024-01-05
188

获取或设置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;

}

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论