简体   繁体   English

C#ODBC驱动程序在Win10上可以正常工作,但在Win7上不能正常工作

[英]C# ODBC Driver working fine on Win10 but not Win7

I got a Problem with an old ODBC Driver for Paradox Database (Intersolv ODBC Paradox Driver). 我有一个旧的Paradox数据库ODBC驱动程序(Intersolv ODBC Paradox驱动程序)出现问题。 I have an application to read and write data to a Paradox database while the Main Program of the Databases is running. 我有一个应用程序可以在数据库主程序运行时读取数据并将其写入Paradox数据库。 I have got Problems before with the MS Paradox Driver. MS Paradox驱动程序之前出现问题。 Now with this driver everything works fine and I can work simultaneously on the Database. 现在,有了该驱动程序,一切正常,我可以同时在数据库上工作。 My Problem is this only works with Windows 10. With Win7 I get an Error when trying to open the Database (SQLAllocHandle error). 我的问题是,这仅适用于Windows10。在Win7中,尝试打开数据库时出现错误(SQLAllocHandle错误)。 If I close the Main Program the driver works. 如果我关闭主程序,则驱动程序可以工作。 I tried to access the Database with a Windows Service and that works on Win7 I can access the Data while the Main Program is open. 我试图使用Windows服务访问数据库,并且该数据库在Win7上可以运行,但可以在打开主程序的同时访问数据。

I tried opening the Application with Adminrights and start it with Psexec System acc. 我尝试使用Adminrights打开应用程序,并使用Psexec System acc启动它。 Always the same error when Main Program is open. 打开主程序时始终出现相同的错误。 Does anyone know whats the difference there between Win7 and Win10? 有谁知道Win7和Win10有什么区别? Both 64 Bit. 两者均为64位。

I was having this exact same problem on a 64 bit system, trying to open a Paradox table to read data while the original Delphi application also was running. 我在64位系统上遇到了完全相同的问题,试图在原始Delphi应用程序也运行的同时打开Paradox表以读取数据。 Using the Microsoft Paradox driver I would get the "External table is not in expected format" error when I tried to execute my ODBC DataReader, and if I used the Intersolv driver, it would give the same SQLAllocHandle error that you are seeing when I tried to open the connection. 使用Microsoft Paradox驱动程序时,当我尝试执行ODBC DataReader时会出现“外部表未采用预期格式”错误,并且如果我使用了Intersolv驱动程序,它将给出与您尝试时看到的相同的SQLAllocHandle错误打开连接。

I found in the comments of this thread: 我在该线程的注释中找到了:

Paradox Table - Oledb Exception: External table is not in the expected format 悖论表-Oledb异常:外部表的格式不正确

that having the connection in a static object made the difference. 在静态对象中建立连接的区别。 In my app, I moved the DB connection and query code to a static class and then it started working. 在我的应用程序中,我将数据库连接和查询代码移至静态类,然后开始工作。 This could possibly be why the Windows service you mentioned was able to read your data. 这可能就是您提到的Windows服务能够读取数据的原因。

I'm not sure as to why the difference between Win7 and Win10, but I suspect that it's a thread permissions issue when trying to open the PDOXUSRS.LCK file. 我不确定为什么Win7和Win10之间会有区别,但是我怀疑尝试打开PDOXUSRS.LCK文件时这是线程权限问题。

Hope this helps you. 希望这对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM