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

What are the advantages using ado.net?

779


What are the different methods by which we can populate a dataset?

975


What is data control techniques?

710


What is the default provider in ado.net?

722


Explain the difference between sqlcommand object and command behavior object?

785


What is the use of data grid?

741


Give an example of a .net application which connects to microsoft access database using ado.net classes.

826


What is the difference between connected and disconnected environment?

750


What is ado oledb and odbc?

721


How to identify the updated rows in a dataset?

742


What is meant by executenonquery?

741


What is ado.net and its architecture?

776


Define isolation?

767


What provider ado.net use by default? Explain the role of data provider in ado.net?

751


The answers which posted above is not satisfied my requirement? Can some one post teh exact answer? Thanx

1822