(接上篇)
二 二、接下来讲使用OLE DB来连接数据库的例子。
1) OLE DB Provider for Active Directory Service
<%
Dim oConn,strConn
Set oConn=Server.CreateObject(“ADODB.Connection”)
StrConn= "Provider=ADSDSOObject;" & _
"User Id=myUsername;" & _
"Password=myPassword;"
oConn.Open strConn
%>
2) OLE DB Provider for DB2
<%
Dim oConn,strConn
Set oConn=Server.CreateObject(“ADODB.Connection”)
StrConn= "Provider=DB2OLEDB;" &
"Network Transport Library=TCPIP;" &
"Network Address=MyServer;" & _
"Package Collection=MyPackage;" &
"Host CCSID=1142"
"Initial Catalog=MyDB;" &
"User ID=MyUsername;" & _
"Password=MyPassword;"
oConn.Open strConn
%>
3) OLE DB Provider for Index Server
<%
Dim oConn,strConn
Set oConn=Server.CreateObject(“ADODB.Connection”)
StrConn= "Provider=msidxs;" & _
"Data source=MyCatalog;"
oConn.Open strConn
%>
4) OLE DB Provider for Internet Publishing
<%
Dim oConn,strConn
Set oConn=Server.CreateObject(“ADODB.Connection”)
StrConn= "Provider=MSDAIPP.DSO;" & _
"Data Source=http://mywebsite/myDir;" & _
"User Id=myUsername;" & _
"Password=myPassword;"
oConn.Open strConn
%>
5) OLE DB Provider for Microsoft Jet
● 标准的也是常用的访问方式。
<%
Dim oConn,strConn
Set oConn=Server.CreateObject(“ADODB.Connection”)
StrConn= "Provider=Microsoft.Jet.OLEDB.4.0;" & _