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 is the use of sqldatareader class?

475


What are the different row versions available in table?

529


What is the difference between dataset and datatable?

485


Describe connection object in ado.net

539


What is ado.net connection?

466






Explain how to pass multiple tables in datasets simultaneously?

495


Why is it important to close an ado.net application?

532


What are the differences between OLEDB and SQLClient Providers?

564


Which is faster dataset or datareader?

523


How will you fill the gridview by using datatable object at runtime?

548


Which components of a data provider is used to retrieve, insert, delete, or modify data in a data source?

618


What is difference between entity framework and ado.net?

479


How do you connect to sql server database without using sqlclient?

560


How to identify the updated rows in a dataset?

517


How does entity framework work?

464