我已经安装了SQL和SQL开发人员版本的实例。我已经使用LINQ实体在SQL开发人员编辑上安装了我的客户数据库。我迁移了tfro SQL,因为我遇到了SQL和n层应用程序(3个项目)的问题。
我已经准备好为我的应用程序添加成员资格提供程序(成员身份和角色提供程序),但我希望确保它是使用创建的。如何创建提供程序?
而且,作为一个新手,我需要帮助为我的ASPNETDB.mdb数据库创建连接字符串。
提前感谢!
发布于 2012-01-04 18:46:51
如果您想使用可信的连接,请使用这样的..。我也建议将这些值移植到web.config或app.config文件中,如果我在.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();https://stackoverflow.com/questions/8732045
复制相似问题