Dear Experts,

I am new in
I have to make a website in asp within 5 months. I have written connection string for sql server 2008 R2.
I want to use "default login" but my connection string does not work.

   <add name="donationConnectionString" connectionString="Data Source=COMPAQ-PC\SQLEXPRESS;Initial Catalog=donation;Integrated Security=True"
   providerName="System.Data.SqlClient" />

And I have created connection on every page. But my connection is not created.


sqlconnection con = new sqlconnection("Data Source=$$$$; Initial Catalog = $$$$$; Integrated Security=true");;

I need your help. . . .

If you add a connection string to the web.config and intend to use it, you access it with this:

sqlConnection con = new sqlConnection(ConfigurationManager.ConnectionString["donationConnectionString"]);

You will need to add System.Configuration to your using statements at the top of the class for this to work. The configurationManager will then go to the web.config file and get the connection string named "donationConnectionString".