Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
im developing a winform and i store my connection in App.config
C#
<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#
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:
C#
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
Posted
Comments
Amol_B 23-Jan-13 4:48am    
"the connection property has not been set or is null" is indication of non initialization of connection. You are reading string from config file, but are you using it in connection?

1 solution

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[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900