连接字符串oledb中的提供者字段 [英] Provider field in connection string oledb

查看:205
本文介绍了连接字符串oledb中的提供者字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我是C#的新手,我对于需要在连接字符串中提供的字段有点困惑,而使用oledb连接到我的sql server 2008数据库,特别是其中之一。

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.

提供者字段真的给我的问题,部分是因为我不确定它是什么。我试过两个不同的Provider字符串,他们都回来了相同的错误:

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:

System.Data.SqlClient提供程序没有注册在本地机器

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

Microsoft.Jet.OLEDB.4.0提供程序未在本地计算机上注册

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?

感谢

推荐答案

Microsoft Jet Engine是Microsoft Access中使用的数据库引擎,需要访问版本未安装,因此,您的应用程序无法打开OLEDB驱动程序。

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.

通常,您应该使用 System.Data。 SqlClient.SqlConnection 类而不是 System.Data.OleDb.OleDbConnection 类连接到您的SQL Server 2008数据库。连接字符串应< a href =http://www.connectionstrings.com/sql-server-2008#p1 =nofollowtitle =SQL Server 2008连接字符串示例>简单得多。

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.

这篇关于连接字符串oledb中的提供者字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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