VB6,C#连Sql server,Mysql,sqlite,access等数据库的连接字符串

前端之家收集整理的这篇文章主要介绍了VB6,C#连Sql server,Mysql,sqlite,access等数据库的连接字符串前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

(1),VB6 连 sql Server

Provider=sqlOLEDB.1;Password=Pwd;Persist Security Info=True;User ID=UserName;Initial Catalog=DataBase_Name;Data Source=IP_Address

(2),C#连 sql Server

1,Windows验证 Common.ConnString = @"Initial Catalog=数据库名;Data Source=电脑名或IP地址;Integrated Security=SSPI";

2,sql混合验证Common.ConnString = @"server=电脑名或IP地址;database=数据库名;uid=用户名;password=密码";


(3),C#连MysqL

MysqLHelper.ConnString = string.Format(@"server={0};database={1};userid={2};password={3}"
,txtServer.Text,txtDBName.Text,txtUid.Text,txtPwd.Text);

(4),C#连sqlite

string.Format(@"Data Source={0}",ConnsqlLiteDbPath); //ConnsqlLiteDbPath 为 **.db文件的具体路径

(5),C#连access

string sDB_Path = Application.StartupPath.Replace(@"\bin\Debug","") + @"\Data\#test.mdb";
//JonseTool.AccessHelper.ConnString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sDB_Path + @";Persist Security Info=false;User Id=admin;Password=";
JonseTool.AccessHelper.ConnString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sDB_Path + @";";

------------------------------------------------------------------------------------------------------

原文链接:https://www.f2er.com/vb/260246.html

猜你在找的VB相关文章