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 all the different authentication techniques used to connect to MS SQL Server?

626


Can we do database operations without using any of the ado.net objects?

619


What is dao and ado?

577


What is command class in ado.net?

560


What is adodb dll?

617






Explain what is datagrid with an example?

678


Explain the various objects in dataset.

600


What are the benefits of using of ADO.NET in .NET 4.0?

620


What is Data view?

661


Which ado.net object is very fast in getting data from the database?

743


What is an orm, and why would you use one instead of plain old ado.net?

667


What is DataRowCollection?

721


What is ado.net in mvc?

587


Define ado.net?

689


describe the dataset object in ado.net.

605