当前位置:编程学习 > asp >>

通过ADO连接各种数据库的字符串翠集(二)(完)

(接上篇)
二 二、接下来讲使用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;" & _
补充:asp教程,数据库相关
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,