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
What DataReader class do in ADO.NET ?
Why do we use sqldataadapter?
What are all the classes that are available in System.Data Namespace?
What is difference between dataset and datatable?
What is the difference between Data adaptor and Data set?
What are typed and untyped dataset?
What is meant by ‘transaction’ in a database and what are the ‘properties of transaction’?
Is ado.net an orm?
What two types of data providers does ADO.NET supply? What determines which one you should use?
describe the dataset object in ado.net.
What are the namespaces used in ADO.Net to connect to a database?
What is the difference between Command and CommandBuilder object?
What are different layers of ADO.Net?
What are advantages of microsoft-provided data provider classes in ado.net?
How do you update database through dataset?