{$cfg_webname}
主页 > 教程 >

VS2005连接Sql2005,Sql2000,Access,Oracle四种数据库的字符串

编辑:admin  来源:wenku163.com

1.Sql server2005

    Data Server=.\SQLEXPRESS;Initial Catalog=Northwind;User ID=sa;Password=sa123456

    Data Server=服务器名\SQLEXPRESS;Initial Catalog=Northwind;User ID=sa;Password=sa123456

    Data Server=localhost\SQLEXPRESS;Initial Catalog=Northwind;User ID=sa;Password=sa123456

    Data Server=.;Initial Catalog=Northwind;User ID=sa;Password=sa123456

    Data Server=服务器名;Initial Catalog=Northwind;User ID=sa;Password=sa123456

    以上五种字符串针对不同的SQL 2005版本

2.Access

string source = @" Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = D:c#connDBschool.mdb";

3.Sql server2000
   
string source = @" server = .kingsql;database = Northwind ; integrated security=SSPI ";

    string source = @" server = .kingsql;database = Northwind ; uid = sa; pwd = sa ";

4.Oracle

(1)ODBC(要求:Oracle Client 7.3以上版本)
"Driver={Microsoft ODBC for Oracle};Server=myServerAddress;Uid=myUsername;Pwd=myPassword;"

(2)OLEDB(要求:Oracle Client 8i以上版本)
"Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;"

(3)System.Data.OracleClient(要求:MDAC 2.6Oracle Client 8i Release 3 (8.1.7) 以上版本)
"Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;"

(4)ODP.NET(要求:Oracle Client 9i以上版本)
"Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;Integrated Security=no;"

(5)OraDirect .net (要求:不需要安装Oracle客户端必须购买许可证)
"User ID=myUsername;Password=myPassword;Host=ora;Pooling

 

推荐