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 current version of entity framework?

486


How to identify the updated rows in a dataset?

521


What is ado oledb and odbc?

503


Does dapper use ado.net?

598


What does executenonquery () method return?

502






What are the key features of ado.net?

669


Which is faster dataset or datareader?

530


Does sqlclient and oledb class share the same functionality?

536


What is the use of data grid?

492


What is oledb connection?

509


Do we use stored procedure in ADO.Net?

574


What is data adapter in ado.net with example?

522


Explain ODP.net

571


What is variable view?

497


What are the benefits of using ado.net?

518