Thank you!!
Dear all,
Me and my friend are new to visual studio 2005 express edition. We are trying to build a simple desktop database application. Now both of us have different connectionString to the database in our computers (which is quite obvious).At first, we used hardcoded connection strings in our apps. So it was a huge task to replace all those lines as we shifted our computers to share our works.
For compatibality, we were trying to use the app.config file for the connectionString, which looks like : (in my computer)
xmlversion="1.0"encoding="utf-8" ?><?
<
configuration><
configSections></
configSections><
connectionStrings><
addname="Prototype1.Properties.Settings.North_Pole_1_1SQLConnectionString"connectionString="Data Source=ISHTIAQUE\SQLEXPRESS;Initial Catalog="North Pole 1.1SQL";Integrated Security=True"providerName="System.Data.SqlClient" /><
addname="Prototype1.Properties.Settings.dbConnection"connectionString="Data Source=ISHTIAQUE\SQLEXPRESS;Initial Catalog="North Pole 1.1SQL";Integrated Security=True" /></
connectionStrings></
configuration>I was trying to replace my connectionStrings. Instead of writing the following code block:
/*
string connectionString ="Integrated Security=SSPI;Persist Security Info=False;" +
"Initial Catalog=North Pole 1.1SQL;Data Source=ishtiaque\\sqlexpress";
SqlConnection Conn =newSqlConnection(connectionString);Conn.Open();
*/
I wrote:
Conn =newSqlConnection(ConfigurationSettings.AppSettings["Prototype1.Properties.Settings.North_Pole_1_1SQLConnectionString"].ToString());SqlConnection
Conn.Open();
But it doesn't work. I ger one warning message at the compile time and one error message at run time.
Warning : 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!
error message:"NullReferenceException was unhandled"
After that my app stops executing.
Can anyone please help me out this problem?

