C \ # 각종 데이터베이스 문 구 를 연결 합 니 다 (인 스 턴 스)

//Access
using System.Data;
using System.Data.OleDb;
connString ="Provider =Microsoft.Jet.OleDb.4.0;Data Source=" + System.Web.HttpContext.Current.Server.MapPath("~/App_Data/MyDataBase.mdb");

 
//SQL server
using System.Data;
using System.Data.SqlClient;

//SQL2005
connString="Data Source=zhou\\sql2005;Initial Catalog=AspNetStudy;Persist Security Info=True;User ID=sa;Password=123456"); 
//SQL2008
connString = @"server=LENOVO-AA\MYDATABASE;database=Database;Trusted_Connection=True";
 
//MySQL 
using MySQLDriverCS;
using System.Net; 
using System.Text; 
using CoreLab.MySql; 
using System.Data.Odbc; 
using MySql.Data.MySqlClient;
MySQLConnection DBConn = new MySQLConnection(new MySQLConnectionString("localhost","mysql","root","",3306).AsString); 
connString = "User Id=root;Host=localhost;Database=qing;password=qing"; 

 
//SyBase
Provider=Sybase.ASEOLEDBProvider.2;Initial Catalog=    ;User ID=   ;Data Source=   ;Extended Properties="";Server Name=ip  ;Network Protocol=Winsock;Server Port Address=5000;
 
//Oracle
using System.Data; 
using System.Data.OracleClient; 
connString="Data Source=sky;user=system;password=manager;";
 
//IBM DB2 
connStri = "Driver={IBM DB2 ODBC DRIVER};Database=sample;hostname=192.168.1.46;port=50000;protocol=TCPIP; uid=admin; pwd=admin";

좋은 웹페이지 즐겨찾기