为什么ADO中Connection和Command的ConnectionTimeout、CommandTimeout中不起作用?

fat1 2000-06-29 05:36:00
有没人遇到?
...全文
414 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
fat1 2000-06-30
  • 打赏
  • 举报
回复
还有没有好心人呀?
cjlong 2000-06-30
  • 打赏
  • 举报
回复
我也遇到过。直今不懂
liyang 2000-06-30
  • 打赏
  • 举报
回复
起作用。但是时间好像不那么准。你的不起作用,要看你的程序如何用的。
fat1 2000-06-30
  • 打赏
  • 举报
回复
试了n次后:
ConnectionTimeout时好时坏,
CommandTimeout就没有好过。
liyang 2000-06-30
  • 打赏
  • 举报
回复
在MSDN有关Adodb.Connection的ConnectionTimeout的Remark中有描述如下:
"Make sure the provider to which you are writing code supports the ConnectionTimeout functionality."

另:在MSDN有关Adodb.Command的CommandTimeout的Remark中有描述如下:
The CommandTimeout setting on a Connection object has no effect on the CommandTimeout setting on a Command object on the same Connection; that is, the Command object's CommandTimeout property does not inherit the value of the Connection object's CommandTimeout value.

On a Connection object, the CommandTimeout property remains read/write after the Connection is opened.

我一般用Provider=Microsoft.sqloledb.1
这两个属性是起作用的。
fat1 2000-06-30
  • 打赏
  • 举报
回复
就是这句了:
Public Sub toll_connect()
On Error GoTo errhandle
If toll_conn.State = adStateOpen Then
toll_conn.Close
End If
With toll_conn
.ConnectionString = GetConnectionStr()
.ConnectionTimeout = GetConnectionTimeout()
.CommandTimeout = GetCommandTimeout()
'.CursorLocation = adUseClient
MsgBox "ConnectionTimeout:" & toll_conn.ConnectionTimeout
.Open
End With
Exit Sub
errhandle:
MsgBox "数据库连接失败!"
End
End Sub
liyang 2000-06-30
  • 打赏
  • 举报
回复
你把你的connection和command的打开方式写一下。这要看具体情况。

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧