我怎样才能连接到.sdf
数据库密码,仍然能够使用的TableAdapter填写我的列表框,此代码:连接到SQL Server CE数据库密码
try
{
tbl_sClipManagerTableAdapter1.Fill(db_sClipManagerDataSet1.tbl_sClipManager);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
生成此错误:
The specified password does not match the database password. [ Data Source = PATH TO .SDF FILE ]
我有密码保护数据库。我如何连接密码并仍然通过tableadapter?
编辑:
哦,我不想与连接字符串存储密码 - 因为它是通过配置文件轻松读取。
SOLUTION:
我自己找到了解决方案。
在DataSet.Designer.cs
找到类似:
private void InitConnection() {
this._connection = new global::System.Data.SqlServerCe.SqlCeConnection();
this._connection.ConnectionString = global::sClipManager.Properties.Settings.Default.db_sClipManagerConnectionString + "; password=PASSWORDHERE";
我刚添加的+ "; password=PASSWORDHERE"
。
现在一切正常。密码不能在配置文件中轻松读取。
问候
如果您自己找到解决方案,请将其添加为问题的答案,并在一天左右后将其标记为接受的答案。通过这种方式,问题将被标记为已回答,搜索的人将会找到您的答案,如果有人提出您的答案,您将获得代表。 – 2012-03-27 18:59:37