asp.net and Oracle,sql server,access database Class (1/8)

Source: Internet
Author: User
Tags access database

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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.