簡體   English   中英

具有SQL 2008 R2開發人員和SQL Express 2008 R2的ASP.Net C#ASPNETDB.mdb

[英]ASP.Net C# ASPNETDB.mdb with SQL 2008 R2 Developers and SQL Express 2008 R2

我已經安裝了SQL Express和SQL Developers版本的實例。 我已經使用LINQ to Entities在SQL Developers Edtion上安裝了客戶數據庫。 我在SQL Express和n層應用程序(3個項目)遇到問題時遷移了SQL Express。

我准備為我的應用程序添加我的成員資格提供程序(成員資格和角色提供程序),但是我想確保它是使用SQL Developers Edition創建的。 如何創建提供者?

另外,作為這樣的新手,我需要為ASPNETDB.mdb數據庫創建CONNECTION STRING的幫助。

提前致謝!

如果您想使用受信任的連接,請使用類似以下的內容:如果我位於.config文件中,我也建議將這些值也移植到web.config或app.config文件中。

<appSettings>
<add key="strConnectionString" value="Data Source=YourDomain\ServerName;
    Initial Catalog=yourDatabaseNameP;User ID=YourUser;Trusted_Connection=yes"/>
</appSettings>

// .NET DataProvider -- Trusted Connection  

using System.Data.SqlClient;

SqlConnection conn = new SqlConnection();
conn.ConnectionString = 
              "Data Source=ServerName;" + 
              "Initial Catalog=DataBaseName;" + 
              "Integrated Security=SSPI;"; 
conn.Open();

要么

// .NET DataProvider -- Standard Connection  

using System.Data.SqlClient;

SqlConnection conn = new SqlDbConnection();
conn.ConnectionString = 
              "Data Source=ServerName;" + 
              "Initial Catalog=DataBaseName;" + 
              "User id=UserName;" + 
              "Password=Secret;"; //change to fit your case
conn.Open();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM