如果你想使用可信连接使用类似这样的..我建议将这些值移植到一个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();
这里是一个不错的视频,你可以参考一下也可以解释如何创建成员资格提供希望这有助于http://www.asp.net/web-forms/ videos/how-do-i/how-do-i-create-a-custom-membership-provider如果你正在寻找一些东西与用户/组有一些脚本必须运行ASPNETDB.mdb我做了这个8个月前,但希望我有这些存储过程粘贴为您运行..设置它也相当容易太.. – MethodMan 2012-01-04 18:50:57
拿一个看看这个链接以及http://msdn.microsoft.com/en-us/library/ms229862(VS.80).aspx是任何这帮助你.. ?? – MethodMan 2012-01-04 19:05:33
我现在正在工作,这是一个个人项目 - 希望今晚能够开展工作。如果需要一些时间才能完成,看起来可能需要等待周末。非常感谢! – Susan 2012-01-04 20:41:48