Database Connectivity by Creating a Class

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2009
Posts: 15
Reputation: Abhishek_Boga is an unknown quantity at this point 
Solved Threads: 0
Abhishek_Boga Abhishek_Boga is offline Offline
Newbie Poster

Database Connectivity by Creating a Class

 
0
  #1
Feb 18th, 2009
Hi, for the few days im trying to connect the database in c# by creating one class called "datasource". For that I first created a Appication Configuration form in that i've written the follwing code:

<configuration>
<AppSettings>
<add key="ConfigurationString" Value="Datasource=(local);Integrated Security=True; Initial Catalog=HRMSYS"/>
</AppSettings>
</Configuration>

and then in the Datasource class

public static void getconnection
{
get
{
return ConfigurationStrings.AppSettings["ConnectionString"];
}
}
the problems is showing in the above line 'return ConfigurationStrings.AppSettings['Connection"]'.....
Kindly help me out how to connect the database through class..
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,248
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 578
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: Database Connectivity by Creating a Class

 
0
  #2
Feb 18th, 2009
It should be located in:
  1. Properties.Settings.Default.ConfigurationString

Unless that is not what you were asking?
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC