如果从 VBA 执行,存储过程不会返回数据
我在 Sybase 数据库中有存储过程 MySPold。我创建了新的 sp MySP。这个新的 sp 在从 Sybase Sql Advantage 执行时返回数据。但从 VBA - Excel 2003 调用时不返回数据(记录集的 EOF 属性为 True)。这是我的代码..
Dim dbCon As ADODB.Connection
Dim rstTemp As New ADODB.Recordset
Dim query As String
query = "exec MySP '01/01/2010', '01/14/2010'"
dbCon.Open connectionString, "username" "password"
dbCon.CommandTimeout = 300
rstTemp.Open query, dbCon, adOpenForwardOnly
该代码与旧 sp 运行良好。 可能是什么问题?有什么想法吗?
提前致谢。
I had stored procedure MySPOld in Sybase db. I created new sp MySP. This new sp returns data while executed from Sybase Sql Advantage. But not returning the data when called from VBA - Excel 2003 (EOF property of recordset is True). Here is my code..
Dim dbCon As ADODB.Connection
Dim rstTemp As New ADODB.Recordset
Dim query As String
query = "exec MySP '01/01/2010', '01/14/2010'"
dbCon.Open connectionString, "username" "password"
dbCon.CommandTimeout = 300
rstTemp.Open query, dbCon, adOpenForwardOnly
The code was working well with old sp.
What could be the problem ? any idea ?
Thanks in Advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设它可以从 isql 或 sql 的优势中正常工作!
您是否在新过程中的任何地方与 null 进行比较?我之前发现,与通过 VBA 或 vbScript 相比,从 isql 等调用时,“if @var = null”之类的语句的行为有所不同。如果你有类似的东西,只需将其更改为“if @var is null”即可。
Am assuming it works ok from isql or sql advantage!
Do you compare with null anywhere in the new procedure? I've found previously that statements like "if @var = null" behave differently when called from isql etc, compared with via VBA or vbScript. If you have something like this just change it to "if @var is null" and it'll work.