创建连接字符串ADO.NET

时间:2015-06-16 15:38:22

标签: c# database connection-string oledb sql-server-express

如何为OleDbConnection创建连接字符串?我尝试了很多组合和变体,但没有任何效果。我使用带有C#的MS-SQL平台为SQL EXPRESS建立连接。

  1. Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Data\Northwind.mdb;User Id=admin;Password=;
  2. Data Source=(local);Provider=SQLOLEDB;Initial Catalog=FastCycle;Integrated Security=true
  3. Persist Security Info=False;Data Source=Northwind;Integrated Security=SSPI;Trusted_Connection=TRUE;providerName=System.Data.OleDb
  4. Provider=SQLOLEDB;Data Source=Northwind.mdb
  5. Provider=SQLEXPRESS;Data Source=Northwind.MDB

1 个答案:

答案 0 :(得分:0)

@paddy向我推荐了这个网站connectionstrings.com。它帮助我找到正确的字符串。那是:

Provider=sqloledb;Data Source=.\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=SSPI;