ASP中连接数据库(ADODB对象):
一、OLEDB连接方法
1.OLE DB Provider for AS/400
connstr = "Provider=IBMDA400;" Data source=myAS400;User Id=myUsername;Password=myPassword;"
2.OLE DB Provider for Active Directory Service
connstr = "Provider=ADSDSOObject;User Id=myUsername;Password=myPassword;"
3.OLE DB Provider for DB2
connstr = "Provider=DB2OLEDB;Network Transport Library=TCPIP;Network Address=MyServer;Package Collection=MyPackage;Host CCSID=1142Initial Catalog=MyDB;User ID=MyUsername;Password=MyPassword;"
4.OLE DB Provider for Index Server
connstr = "Provider=msidxs;Data source=MyCatalog;"
5.OLE DB Provider for Internet Publishing
connstr = "Provider=MSDAIPP.DSO;Data Source=url;User Id=myUsername;Password=myPassword;"
6.OLE DB Provider for Microsoft Jet(access-this way will be best)
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dbpath;User Id=admin;Password=;"
7.OLE DB Provider for Microsoft Jet(Excel)
connstr = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dbpath;Extended Properties=""Excel 8.0;HDR=Yes;"";"
["HDR=Yes" means that there is a header row in the cell range (or named range), so the provider will not include the first row of the selection into the recordset. If "HDR=No", then the provider will include the first row of the cell range (or named ranged) into the recordset]
9.OLE DB Provider for Microsoft Jet(textfile)
connstr = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dbpath;Extended Properties=""text;HDR=Yes;FMT=Delimited;"";"
10.OLE DB Provider for ODBC Databases(access)
connstr = "Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb)};Dbq=dbpath;Uid=myUsername;Pwd=myPassword;"
11.OLE DB Provider for ODBC Databases(SQL)
connstr = "Provider=MSDASQL;Driver={SQL Server};Server=myServerName;Database=myDatabaseName;Uid=myUsername;"Pwd=myPassword;"
12.OLE DB Provider for Oracle (from Microsoft)
connstr = "Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;"
13.OLE DB Provider for Simple Provider
connstr = "Provider=MSDAOSP;Data Source=MSXML2.DSOControl.2.6;"
14.OLE DB Provider for SQL Server
"Provider=sqloledb;Data Source=myServerName;Initial Catalog=myDatabaseName;User Id=myUsername;Password=myPassword;"
[if connection with ip address]
connstr = "Provider=sqloledb;Data Source=xxx.xxx.xxx.xxx,1433;Network Library=DBMSSOCN;Initial Catalog=myDatabaseName;User ID=myUsername;Password=myPassword;"
[1433 为SQL数据库默认接口]
posted on 2007-08-05 18:12
汪杰 阅读(1544)
评论(2) 编辑 收藏 引用 所属分类:
asp(javascrpt)