更新时间:2023-10-17 08:47:46
你不应该以这种方式存储和访问你的连接字符串。
按照Microsoft的建议执行: http://msdn.microsoft.com/ en-us / library / ms254494(v = vs.80).aspx [ ^ ]
im developing a winform and i store my connection in App.config
<add key="CS" value="Server=localhost;User ID=root;Password=123456;Persist Security Info=True;Database=dbMember"/>
and this is how i call the connectionString from C#
string CS = System.Configuration.ConfigurationManager.AppSettings.Get("CS");
yes, it can run smoothly at my machine, how it show error msg: "the connection property has not been set or is null", when i try to run it at another PC.
but it working at another PC if i manually code the connectionstring like this:
string CS= "Server=localhost;User ID=root;Password=123456;Persist Security Info=True;Database=dbMember";
any advice? i already install the same version of sql at both PC
You shouldn''t store and access your connection strings this way.
Do it as suggested by Microsoft: http://msdn.microsoft.com/en-us/library/ms254494(v=vs.80).aspx[^]