ODBC的运行方式不同,具体取决于查询运行时的顺序 [英] ODBC acts different depending on order when querys are run

查看:103
本文介绍了ODBC的运行方式不同,具体取决于查询运行时的顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在C ++应用程序中有一个奇怪的行为.它通过DAO连接到Access 2010数据库. Access数据库的表已通过ODBC链接到SQL Server2008.

当我在一个表上运行一个包含BETWEEN语句的特定查询,然后在另一个表上运行另一个也包含BETWEEN语句的查询时,第二个查询将失败,并显示ODBC错误,表明语法不正确.此后,ODBC驱动程序将不断继续返回语法错误.

但是,如果我先运行第二个查询,则运行任何查询都没有问题.只要会话正在运行,就不会显示任何错误.

我试图通过ODBC管理器跟踪ODBC,但是由于跟踪似乎锁定了我的应用程序,因此未成功.

Hi,

I have got a strange behavior within a c++ application. It connects through DAO to an Access 2010 database. The Access database has got its tables linked to a SQL Server 2008 through ODBC.

When I run a particular query, containing a BETWEEN-statement, on one table before running another query, also containing a BETWEEN-statement, on another table, the second query will fail with ODBC errors indicating that the syntax is incorrect. The ODBC driver will constantly continue to return syntax error after this.

But if I run the second query first, there are no problems running any of the queries. No error will be displayed as long as the session is running.

I tried to trace the ODBC through the ODBC Manager, but was unsuccessful since the tracing seemed to lock my application.

Any ideas on how to find out what is going wrong?

推荐答案

您知道DAO已经过时了很长时间,对吗?它也不能在64位Windows上运行.

我强烈建议放弃DAO并改用OLE DB来使用Access数据库.

您是否有使用Access而不直接使用的SQL Server的任何特殊原因?删除访问权限将消除一定程度的复杂性并提高性能.

数据访问技术路线图 [
You know DAO has been deprecated for quite some time now, right? It also won''t work on 64-bit Windows.

I highly suggest abandoning DAO and switching to OLE DB for using Access databases.

Do you have any particular reason for using Access and not going direct to the SQL Server using ? Removing Access would eliminate a level of complexity and improve performance.

Data Access Technologies Roadmap[^] circa December 2009


我发布了路线图的链接,您可以选择一项技术.请记住,Windows 8很有可能不会以32位版本提供.因此,如果您的应用程序要持续这么长时间,则必须使用与x64兼容的东西对其进行重写.

您可以使用ADO.NET,但这需要重写您的非托管应用程序以承载.NET Framework和进行数据访问的组件.但是,如果您要经历那么多麻烦,为什么不使用.NET Framework和C ++/CLI将非托管应用程序重写为托管应用程序呢?
I posted the link to the Roadmap so YOU could pick a technology. Keep in mind, it''s entirely likely that Windows 8 will NOT be available in 32-bit. So if your app is going to last that long, you''re going to have to rewrite it with something x64 compatible.

You could use ADO.NET, but that would require that your unmanaged app be rewritten to host the .NET Framework and a component that does the data access. But, if you were going to go through that much trouble, why not just rewrite the unmanaged app into a managed one using the .NET Framework and C++/CLI...


这篇关于ODBC的运行方式不同,具体取决于查询运行时的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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