Provider field in connection string oledb

本秂侑毒 提交于 2019-12-13 04:09:22

问题


Hey guys I'm new to C# and I'm a little confused on the fields that need to be provided in the connection string while using oledb to connect to my sql server 2008 database, particularly one of them.

The "Provider" field is really giving me problems, partially because I'm not really sure what it does. I have tried two different Provider strings and they both come back with the same error:

The "System.Data.SqlClient provider is not registered on the local machine

Or

The "Microsoft.Jet.OLEDB.4.0" provider is not registered on the local machine

Can someone tell me what this means? Also, my task requires me to not use any addition installations, is there a provider that is default?

Thanks


回答1:


The Microsoft Jet Engine is the database engine used in Microsoft Access. The error simply means that the required Access version is not installed and thus, your application cannot open the OLEDB driver.

Generally, you should probably just use the System.Data.SqlClient.SqlConnection class instead of the System.Data.OleDb.OleDbConnection class to connect to your SQL Server 2008 database. The connection string should be much simpler.



来源:https://stackoverflow.com/questions/9856466/provider-field-in-connection-string-oledb

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