【发布时间】:2010-06-30 11:51:36
【问题描述】:
感谢 dretzlaff17 的回复,
我正在提供细节............
来自 SQL Server 2005 的 SP 未返回 recordSet (VB6) 中的记录,记录返回为 -1。如果使用查询和通过记录集访问记录,则记录集正在填充记录。
使用相同的连接字符串。我检查正确,用VB6编写的命令对象代码没有问题,那是什么问题?
在访问 SQL Server 2005 时,我们还有什么需要做的吗?
我的代码是这样的
Dim Conn as new ADODB.Connection
Dim RS as new ADODB.RecordSet
Dim CMD as new ADODB.Command
Conn.Open "Connection String" ' Its working
CMD.ActiveConnection = Conn
CMD.CommandType = adCmdStoredProc
CMD.CommandText = "SPName"
Set RS = CMD.Execute
Debug.Print RS.RecordCount ' /* here result is -1 means CMD is not executing and RS is not filling with records */
and if use
RS.Open "Select query", conn 'then this record set is filling with records.
我还通过将 RS(光标)位置值设置为客户端进行检查,SP 很简单,只有选择查询存在于 SP 中,没有 I/O 参数。
数据库表中存在的另一件事记录不为空。
请对此发表你的看法
谢谢
【问题讨论】:
标签: vb6