Microsoft Access required for C# database access on end-user machines?

江枫思渺然 提交于 2019-12-12 21:19:36

问题


Silly question, perhaps.

I've developed an app on my machine that uses a Microsoft Access database (.mdb) to access certain information and populate a table with monitoring data using OLEDb.

The application works fine on my machine, but when I put the release on test machines (without MS Access), it crashes. Interestingly, if I were to launch the application on the testing machine with the database filename just renamed, it loads like it should albeit without the data.

I seem to get an UnauthorizedAccessException exception thrown which further clouds my confusion.

Both the development machine and the machine I'm testing it on have .NET 3.5 installed.

I would expect a barage of 'No's in reply to my question, but what the heck - does the testing machine need to have MS Access installed?

Regards


回答1:


Try downloading the Office Connectivity Components here. This will let you read and create Access databases without having Access installed.




回答2:


It doesn't need MS Access but you will need the required driver for your version of Access. You may need to do a test release that outputs to a log the exact Exception and message.




回答3:


Make sure you have latest Jet 4 OLEDB drivers installed. There might also be a problem if you run the application from a network share (then it runs with restricted rights).




回答4:


You say you got an UnauthorizedAccessException. I'd check read/write permissions to the .mdb file and location first.

If you're running as a service remember that they run under more restricted accounts.




回答5:


You don't need Access itself. You will need to have JET drivers and associated files at least as current as the ones on your development machine — if you're recycling an old machine to use for testing that could be the problem.

However, this really sounds like a permissions issue, either on the database file itself or inside the file if you're using Access's security mechanisms.




回答6:


It turns out the issue was a hardware problem. One of the serial ports on the card I was using had gone capput when it got moved to a new machine.

Turns out the problem wasn't database related, as the exception would've suggested.

Some interesting points on JET were raised though, which could be useful to anyone with Database access issues.

Thanks for your help guys.



来源:https://stackoverflow.com/questions/1688468/microsoft-access-required-for-c-sharp-database-access-on-end-user-machines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!