//'Object reference not set to an instance of an object.'
Please Do not mark it as redundant question .
I have tried almost all the methods to make a connection string
first one is by :
string connectionString = ConfigurationManager.ConnectionStrings["ClinicalConnectionString"].ConnectionString;
the second one :
string connectionstringgg = Properties.Settings.Default.ClinicalConnectionString;
third method is by :
ConnectionStringSettings connectionSetting = ConfigurationManager.ConnectionStrings["ClinicalConnectionString"];
//the name of the connection i made
SqlConnection connection = new SqlConnection(connectionString);
In the app config:
<connectionStrings>
<add name="ClinicalDAO.Properties.Settings.ClinicalConnectionString"
connectionString="Data Source=DESKTOP-I07DSQC;Initial Catalog=db_clinics;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
In the web config
<connectionStrings>
<add name="ClinicalDAO.Properties.Settings.ClinicalConnectionString"
connectionString="Data Source=DESKTOP-I07DSQC;Initial Catalog=db_clinics;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
ANY HELP PLEASE it still give me the same error : /////'Object reference not set to an instance of an object.'///
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…