“直接执行SQL;没有光标." Access 2007 VB代码中的错误 [英] "Executing SQL directly; no cursor." error in Access 2007 VB code

查看:102
本文介绍了“直接执行SQL;没有光标." Access 2007 VB代码中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Access 2007数据库中有一个通过VB代码运行的存储过程.通常,代码可以正常运行;但是有时我会收到以下错误:

I've got a stored procedure I run from VB code in an Access 2007 database. Usually the code runs fine; however sometimes I receive the following error:

错误#-2147217900由Microsoft OLE DB提供程序生成,用于 ODBC驱动程序[Microsoft] [SQL Server Native Client 10.0] [SQL 服务器]直接执行SQL;没有光标.

Error # -2147217900 was generated by Microsoft OLE DB Provider for ODBC Drivers [Microsoft][SQL Server Native Client 10.0][SQL Server]Executing SQL directly; no cursor.

我对此进行了大量研究,但我没有提出太多建议.我看到了两个消息源:一个原因是权限不足,另一个原因与存储过程本身的问题有关.我知道权限不是问题.同样,无论我运行了多少次,存储过程在Management Studio中都可以正常运行.

I have done quite a bit of research on this and I haven't come up with much. There are two sources I've seen: one of the reasons is insufficient permissions, and the other has to do with a problem in the Stored Procedure itself. I know the permissions is not an issue. Also the stored procedure runs absolutely fine in management studio no matter how many times I run it.

请帮助!!!

推荐答案

与同事一起发现了问题.从根本上说,核心问题是真正的问题被通用错误消息所掩盖.在这种情况下,出现无光标"错误.诀窍是弄清楚实际的错误消息是什么.经过深思熟虑,同事将我的帖子中提到的ODBC驱动程序从"SQL Server Native Client 10"更改为较旧的MS SQL Server驱动程序;新版本10消除了错误,而旧版驱动程序则揭示了存储过程中的实际错误(由于我自己的测试,我认为最初不是这种情况).因此,最重要的是要从两点出发:首先,如果遇到此错误,请尝试上述技巧尝试揭示实际错误,第二点是注意,这种情况下的真正问题是驾驶员隐藏了编程问题.

Working with a colleague the problem was identified. Fundamentally the core issue was that the real problem was being obfuscated by a generic error message; in this case the "no cursor" error. The trick was to figure out what the actual error message is. Having given some thought to it a coworker changed the ODBC driver from "SQL Server Native Client 10" as noted in my post to an older MS SQL Server driver; while the newer version 10 obfuscated the error the older driver revealed the actual error which was in the stored procedure (which I had believed was not the case originally due to my own testing). So the bottom line is there are two points to take from this: first if you are having this error try the above trick to try and reveal the actual error and the second note, the real problem in this case was that the driver was hiding the programming problem.

这篇关于“直接执行SQL;没有光标." Access 2007 VB代码中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆