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

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

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


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

Add connection string App.config file like below

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

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