mysql 创建不了数据库连接,MSSQL数据库不能手动创建新的连接

以下为引用的内容:

MSDN说明:

Tips for Working with Cursors

Some providers,such as sql Server,implement a forward-scrolling,read-only (or 'firehose') cursor mode,meaning that they can efficiently retrieve data by keeping a connection open. When working with such providers,the connection could be blocked by another user's transaction. The following examples demonstrate scenarios

that result in errors.

dbConn.Open "DSN=sqlForum;UID=sa;PWD=;"

'Example 1

dbConn.BeginTrans

RS.Open "Select * FROM Message",dbConn

Set dbCmd.ActiveConnection = dbConn

Example 1: The problem is that the command object's ActiveConnection is being set to a connection that is forward-scrolling and in 'firehose' mode. This is the same connection involved in the batch mode. The error from the provider will only appear in the Err object,and it will return as unspecified. For example,with the ODBC

Provider,you will get "Unspecified error".

dbConn.Open "DSN=sqlForum;UID=sa;PWD=;"

'Example 2

RS.Open "Select * FROM Message",dbConn

dbConn.BeginTrans

Example 2: The problem here is that the connection is forward-scrolling and in firehose mode,so it cannot be put into transaction mode. The error returned in the Errors collection from the provider will indicate that it is operating in firehose mode,and can't work in transaction mode. For example,with the ODBC Provider against

Microsoft sql Server,you will get the error "Cannot start transaction while in firehose mode".

dbConn.Open "DSN=sqlForum;UID=sa;PWD=;"

'Example 3

RS.Open "Select * FROM Message",dbConn

Set dbCmd.ActiveConnection = dbConn

dbConn.BeginTrans

Example 3: The problem here is that the connection is in forward-scrolling firehose mode,so it cannot also be involved in a batch mode. The error returned in the Errors collection from the provider will indicate that the transaction could not be started. For example,with the ODBC Provider against Microsoft sql Server,you will get the error "Cannot start transaction because more than one hdbc is in use".

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值