HOw to create database connection using console application. in .Net

Posted by Rcroyal88 under C# on 8/9/2011 | Points: 10 | Views : 6606 | Status : [Member] | Replies : 1
hi,


i want to create a database connection using console application. in .Net
can you help me in this.




Responses

Posted by: Ashoknalam on: 8/9/2011 [Member] Starter | Points: 25

Up
0
Down
Add connection string App.config file like below
<connectionStrings>

<add name="DBConStr" connectionString="Your connectino string over here" providerName="System.Data.EntityClient" />
</connectionStrings>



Add System.Configuration reference to your project.

In your code file access the connection string which is written in app.config file.
string varConStr=System.Configuration.ConfigurationManager.ConnectionStrings["DBConStr"].ConnectionString;



Ashok Nalam

Rcroyal88, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response