The article provides the database tutorial the connection code is an ASP tutorial. NET and Oracle,sql server,access database class Oh, if you're a asp.net tutorial developer then you're cool, this is a. NET can be used with the Oracle,sql server , access is connected. Oh, if you use this kind of database can be used directly, but also solve the various database connectivity problems.
using System;
Using System.Collections;
Using System.Collections.Specialized;
Using System.Data;
Using System.Data.SqlClient;
Using System.Data.OleDb;
Using System.Data.OracleClient;
Using System.Configuration;
Using System.Reflection;
Namespace Systemframework.dal
{
/**////<summary>
All rights reserved
Data access base class
Users can modify the need to meet their own projects.
</summary>
public class Databaselayer
{
Database connection string (Web.config to configure)
<add key= "ConnectionString" value= "server=127.0.0.1;database=database;uid=sa;pwd="/>
private string ConnectionString;
public string conntionstring
{
Get
{
return connectionstring;
}
Set
{
ConnectionString = value;
}
}
Public Databaselayer (String strconnect,string datatype)
{
this.conntionstring = strconnect;
This.dbtype = datatype;
}
Public Databaselayer ()
{
this.connectionstring = Configurationsettings.apps Tutorial ettings["ConnectionString"];
This.dbtype = configurationsettings.appsettings["datatype"];
}
/**////<summary>
Database type
</summary>
private String DbType;
public String DbType
{
Get
{
if (DbType = = String.Empty | | dbtype = NULL)
{
return "Access";
}
Else
{
Return dbtype;
}
}
Set
{
if (value!= string.empty && value!= null)
{
DbType = value;
}
if (dbtype ==string.empty | | | dbtype = NULL)
{
DbType = configurationsettings.appsettings["datatype"];
}
if (DbType = = String.Empty | | dbtype = NULL)
{
DbType = "Access";
}
}
}
Home 1 2 3 4 5 6 7 8
last