繁体   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