How to you declare connection strings and how to you make
use of web.config ?

Answer Posted / prasad

In web.config file just plase

<appSettings>
<add key="ConStr" value="Provider=SQLOLEDB.1;User
ID=sa;Initial Catalog=Sample;Data Source=ABC"></add>
</appsettings>

and in CS file

sqlconnection con = new sqlconnection
(ConfigurationSettings.AppSettings["ConStr"]);

and u can u this connection any where in ur App.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to bind the controls(best practice) comboboxes to the data in the dataset?

802


Define Execute Scalar?

761


What is a data control clerk?

788


What does datareader object do?

757


Does executenonquery return a value?

723


Explain how to call the sql commands asynchronously in ado.net version 2.0?

719


Which method is used to sort the data in ADO.Net?

1757


What is connected architecture in ado.net?

705


What is difference between datagridview and datagrid control in winforms?

717


What is an example of ordinal data?

742


What is bubbled event can you please explain?

745


How we can provide data to ado.net?

768


What is the difference between the clone() and copy() methods of the dataset class?

785


What is executequery?

699


What is microsoft ado.net?

803