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..

It should be located in:

Properties.Settings.Default.ConfigurationString

Unless that is not what you were asking?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.