C# 连接字符串的密码
我有以下连接字符串:C# 连接字符串的密码,c#,entity-framework,connection-string,C#,Entity Framework,Connection String,我有以下连接字符串: private static string connString = "data source=\"" + LIB.Environment.App.DirToAbsolutePath("").Replace('/', '\\') + "SOMETHING.sdf\""; 。。。此连接字符串有效,但不安全。现在我想为这个
private static string connString = "data source=\"" +
LIB.Environment.App.DirToAbsolutePath("").Replace('/', '\\') +
"SOMETHING.sdf\"";
。。。此连接字符串有效,但不安全。现在我想为这个连接字符串添加一个密码。
所以我试过这样做:
private static string connString = "data source=\"" +
LIB.Environment.App.DirToAbsolutePath("").Replace('/', '\\') +
"SOMETHING.sdf\"" + "password=\""+"trial\"";
甚至可以这样添加密码吗?如果是的话,你们中有人能帮我吗
谢谢大家! 是的,你能做到。您必须提及用户Id和密码。您的最终连接字符串应该如下所示
data source="SOMETHING.sdf";User ID=userid;Password=pwd
有一个极好的网站可以解答这样的问题。也不要连接字符串。使用格式使生活更轻松-您缺少密码单词前的空格。请检查该类。它有各种有用的方法来分解和以编程方式创建连接字符串。@Reniuz非常感谢您!这很好用。