C# 常用数据库连接字符串, SQL Server, MySQL, Oracle, Access mdb

C# 常用数据库连接字符串, SQL Server, MySQL, Oracle, Access mdb
// SqlServer-Windows Authentication
string connectionString = "Data Source=127.0.0.1,1433;Initial Catalog=TestDB;connect timeout=10;Integrated Security=True";
// SqlServer-Account & Password
string connectionString = "Data Source=127.0.0.1,1433;Initial Catalog=TestDB;uid=sa;pwd=123456";

// MySql-Account & Password
string connectionString = "server=127.0.0.1;port=3306;database=TestDB;charset=utf8;user id=root;password=123456;pooling=false;";

// Oracle-Account & Password
string connectionString = "Data Source=(DESCRIPTION=(ADDRESS =(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1522))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=TestDB)));User Id=scott;Password=123456";

// Access-connect mdb
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Test.mdb" + ";Jet OLEDB:Database Password=123456;Persist Security Info=False";
// Access-connect accdb
string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Application.StartupPath + "\\Test.accdb" + ";Jet OLEDB:Database Password=123456;Persist Security Info=False";
// Access-connect mdb - ASP.NET(App_Data)
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"|DataDirectory|\\TestDB.mdb\";Jet OLEDB:database password=987654321;Persist Security Info=False";
// Access-connect accdb - ASP.NET(App_Data)
string connectionString = "Provider=Microsoft.Jet.OLEDB.12.0;Data Source=\"|DataDirectory|\\TestDB.accdb\";Jet OLEDB:database password=987654321;Persist Security Info=False";
// Access-connect mdb - ASP.NET
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Web.HttpContext.Current.Server.MapPath("~//Test.mdb") + ";Jet OLEDB:Database Password=123456;Persist Security Info=False";
// Access-connect accdb - ASP.NET
string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + System.Web.HttpContext.Current.Server.MapPath("~//Test.accdb") + ";Jet OLEDB:Database Password=123456;Persist Security Info=False";


作者最新文章
Winform TextBox (文本框) 密码输入框, 输入内容显示*号 (星号)
Winform 启动前弹出登录界面, 登录成功之后再显示主界面
C# 字符串string和字符数组char[]的相互转换
C# 字符串倒序输出, 实现字符串倒序的方法
Winform 如何从 TextBox(文本框) 控件读取每一行数据到数组