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

17 篇文章 0 订阅
10 篇文章 0 订阅

(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 + @";";

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

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值