| | |
Database Connectivity by Creating a Class
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2009
Posts: 15
Reputation:
Solved Threads: 0
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..
<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:
Unless that is not what you were asking?
c# Syntax (Toggle Plain Text)
Properties.Settings.Default.ConfigurationString
Unless that is not what you were asking?
![]() |
Similar Threads
- JSP database connectivity according to Model View Controller (MVC) Model 2 (JSP)
- socket connection (Java)
- Database connectivity to ms-access (Java)
- VB.Net - developing compiler (VB.NET)
Other Threads in the C# Forum
- Previous Thread: How to create event handler for dynamic object
- Next Thread: Programming for synchronization of remote database with local database
| Thread Tools | Search this Thread |
.net 2007 access ado.net algorithm array barchart bitmap box broadcast buttons c# check checkbox client color combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format formbox forms function gdi+ httpwebrequest image index input install java label list listbox listener mandelbrot math mouseclick msword mysql opening operator parse path photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox round saving serialization server sleep socket sql statistics stream string table tcp temperature text textbox thread time timer update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






