⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ado连接数据库字符串大全(vp,excel,文本,sybase,.net等).htm

📁 较为详细的介绍了asp自定义的各种函数,方便asp的各种开发.
💻 HTM
📖 第 1 页 / 共 5 页
字号:
              Database<BR>(Note, if you get a Logon dialog, then click Cancel, 
              then perform a one-time free signup with Oracle's TechNet 
              system)</P>
              <P></P>
              <P>OLE DB Provider for Simple Provider <BR>  <BR>The Microsoft OLE 
              DB Simple Provider (OSP) allows ADO to access any data for which a 
              provider has<BR>been written using the OLE DB Simple Provider 
              Toolkit. Simple providers are intended to access data<BR>sources 
              that require only fundamental OLE DB support, such as in-memory 
              arrays or XML documents.</P>
              <P>OSP in MDAC 2.6 has been enhanced to support opening 
              hierarchical ADO Recordsets over arbitrary<BR>XML files. These XML 
              files may contain the ADO XML persistence schema, but it is not 
              required. This<BR>has been implemented by connecting the OSP to 
              the MSXML2.DLL, therefore MSXML2.DLL or newer is<BR>required.</P>
              <P>oConn.Open "Provider=MSDAOSP;" &amp; _<BR>          "Data 
              Source=MSXML2.DSOControl.2.6;"</P>
              <P>oRS.Open "http://WebServer/VirtualRoot/MyXMLFile.xml", 
oConn</P>
              <P><BR>For more information, see: Microsoft OLE DB Simple 
              Provider</P>
              <P></P>
              <P>OLE DB Provider for SQL Server <BR>  <BR>For Standard 
              Security:</P>
              <P>oConn.Open "Provider=sqloledb;" &amp; _ <BR>          "Data 
              Source=myServerName;" &amp; _<BR>          "Initial 
              Catalog=myDatabaseName;" &amp; _<BR>          "User 
              Id=myUsername;" &amp; _<BR>          "Password=myPassword;"</P>
              <P>For a Trusted Connection:</P>
              <P>oConn.Open "Provider=sqloledb;" &amp; _<BR>          "Data 
              Source=myServerName;" &amp; _<BR>          "Initial 
              Catalog=myDatabaseName;" &amp; _<BR>          "Integrated 
              Security=SSPI;"</P>
              <P>To connect to a "Named Instance" (SQL Server 2000)</P>
              <P>oConn.Open "Provider=sqloledb;" &amp; _<BR>          "Data 
              Source=myServerName\Inst2;" &amp; _<BR>          "Initial 
              Catalog=myDatabaseName;" &amp; _<BR>          "User 
              Id=myUsername;" &amp; _<BR>          "Password=myPassword;"</P>
              <P>To Prompt user for username and password:</P>
              <P>oConn.Provider = "sqloledb"<BR>oConn.Properties("Prompt") = 
              adPromptAlways<BR>oConn.Open "Data Source=myServerName;" &amp; 
              _<BR>          "Initial Catalog=myDatabaseName;" </P>
              <P>To connect via an IP address:</P>
              <P>oConn.Open "Provider=sqloledb;" &amp; _<BR>          "Data 
              Source=xxx.xxx.xxx.xxx,1433;" &amp; _<BR>          "Network 
              Library=DBMSSOCN;" &amp; _<BR>          "Initial 
              Catalog=myDatabaseName;" &amp; _<BR>          "User 
              ID=myUsername;" &amp; _<BR>          "Password=myPassword;" </P>
              <P>Note: <BR>- xxx.xxx.xxx.xxx is an IP address<BR>- "Network 
              Library=DBMSSOCN" tells OLE DB to use TCP/IP rather than Named 
              Pipes (Q238949)<BR>- 1433 is the default port number for SQL 
              Server<BR>- You can also add "Encrypt=yes" for encryption </P>
              <P>For more information, see: Microsoft OLE DB Provider for SQL 
              Server</P>
              <P><BR></P>
              <P>Remote Data Service (RDS) Connections<BR>The following examples 
              show how to connect to a remote database using the RDS Data 
              Control.<BR>When using the RDS DataControl's Server/SQL/Connect 
              properties, the RDS DataControl uses the <BR>RDS DataFactory on 
              the remote server. If you use the RDS DataControl's URL property, 
              <BR>then the RDS DataFactory is not used at all.</P>
              <P>WARNING: The RDS DataFactory can be a major security hole if 
              not setup and configured correctly!<BR>For more information, see 
              RDS FAQ #24 </P>
              <P>RDS DataControl - Connect Property <BR>  <BR>With the RDS 
              default handler disabled (not recommend due to security 
risks):</P>
              <P>With oRdc<BR>  .Server = "http://carl2"<BR>  .Sql = "Select * 
              From Authors Where State = 'CA'"<BR>  .Connect = 
              "Provider=sqloledb;" &amp; _<BR>           "Data Source=(local);" 
              &amp; _<BR>           "Initial Catalog=pubs;" &amp; 
              _<BR>           "User Id=sa;" &amp; _<BR>           
              "Password=;"<BR>  .Refresh<BR>End With</P>
              <P>With the RDS default handler enabled (recommend):</P>
              <P>With oRdc<BR>  .Server = "http://carl2"<BR>  .Handler = 
              "MSDFMAP.Handler"<BR>  .Connect = "Data Source=MyConnectTag;"<BR>  
              .Sql = "MySQLTag(""CA"")"<BR>  .Refresh<BR>End With </P>
              <P>The corresponding CONNECT and SQL sections in the default 
              handler \WINNT\MSDFMAP.INI file would be:</P>
              <P>[connect MyConnectTag]<BR>Access = ReadWrite<BR>Connect = 
              "Provider=sqloledb;Data Source=(local);Initial Catalog=pubs;User 
              Id=sa;Password=;" </P>
              <P>[sql MySQLTag]<BR>Sql = "Select * From Authors Where State = 
              '?'"</P>
              <P>For more information about the RDS Default Handler, 
              see:<BR>Q243245, Q230680, and RDS Customization Handler Microsoft 
              articles<BR></P>
              <P>RDS DataControl - URL Property <BR>  <BR>To get records from a 
              remote database:</P>
              <P>With oRdc<BR>  .URL = 
              "http://carlp0/Authors_GetByState.asp?state=CA"<BR>  
              .Refresh<BR>End With</P>
              <P>To save, set the URL property to an ASP web page:</P>
              <P>With oRdc<BR>  .URL = 
              "http://carlp0/rdsdatacontrol/Authors_Save.asp"<BR>  
              .SubmitChanges<BR>End With</P>
              <P>For more information, see: RDS URL Property</P>
              <P><BR></P>
              <P>ADO URL Connections<BR>ADO 2.5+ allows you to open up a 
              Recordset based on XML returned from an ASP file over 
              HTTP. <BR>This feature doesn't use RDS at all.</P>
              <P>ADO Recordset <BR>  <BR>To get records from a remote 
              database:</P>
              <P>oRs.Open "http://carlp0/Authors_GetByState.asp?state=CA", , 
              _<BR>                      adOpenStatic, adLockBatchOptimistic 
</P>
              <P>To save changes, you must use the MSXML's XMLHTTP object to 
              POST back the updated XML. <BR>The Recordset's Update and 
              UpdateBatch methods will not work in this case.</P>
              <P>' Save Recordset into Stream<BR>Set oStm = New 
              ADODB.Stream<BR>oRs.Save oStm, adPersistXML</P>
              <P>' Use MSXML's XMLHTTP object to open ASP and post a XML 
              stream<BR>Set oXMLHTTP = New MSXML2.XMLHTTP30<BR>oXMLHTTP.Open 
              "POST", "http://carlp0/Authors_Save.asp", False<BR>oXMLHTTP.Send 
              oStm.ReadText</P>
              <P>' If an error occurred<BR>If oXMLHTTP.Status = 500 Then<BR>  
              Debug.Print oXMLHTTP.statusText<BR>End If</P>
              <P>For more information, see: ADO Recordset's Open Method</P>
              <P><BR></P>
              <P>MS Remote Provider Connections<BR>The following connections 
              strings use Microsoft's remote provider (MS Remote). The MS 
              Remote<BR>provider tells ADO to communicate with the remote server 
              (via the RDS DataFactory) and to use <BR>the remote provider that 
              is installed on the remote server.</P>
              <P>WARNING: The RDS DataFactory can be a major security hole if 
              not setup and configured correctly! <BR>For more information, see 
              RDS FAQ #24 <BR>  </P>
              <P>MS Remote - Access (Jet) <BR>  <BR>If you want to use an ODBC 
              DSN on the remote machine:</P>
              <P>oConn.Open "Provider=MS Remote;" &amp; _<BR>          "Remote 
              Server=http://myServerName;" &amp; _ <BR>          "Remote 
              Provider=MSDASQL;" &amp; _<BR>          "DSN=AdvWorks;" &amp; 
              _<BR>          "Uid=myUsername;" &amp; _<BR>          
              "Pwd=myPassword;" </P>
              <P>If you want to use an OLE DB Provider on the remote 
machine:</P>
              <P>oConn.Open "Provider=MS Remote;" &amp; _ <BR>          "Remote 
              Server=http://myServerName;" &amp; _<BR>          "Remote 
              Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _<BR>          "Data 
              Source=c:\somepath\mydb.mdb;", _<BR>          "admin", ""</P>
              <P>If you want to use an OLE DB Provider on the remote machine 
              (via RDS DataFactory Default Handler):</P>
              <P>oConn.Open "Provider=MS Remote;" &amp; _ <BR>          "Remote 
              Server=http://myServerName;" &amp; _<BR>          
              "Handler=MSDFMAP.Handler;" &amp; _<BR>          "Data 
              Source=MyAdvworksConn;"</P>
              <P>The corresponding entry in the \winnt\Msdfmap.ini file would 
              be:</P>
              <P>[connect MyAdvworksConn]<BR>Access = ReadWrite<BR>Connect = 
              "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _<BR>        "Data 
              Source=mydb.mdb;" &amp; _<BR>        "User Id=admin;" &amp; 
              _<BR>        "Password=;"<BR> </P>
              <P>MS Remote - SQL Server <BR>  <BR>If you want to use an ODBC DSN 
              on the remote machine:</P>
              <P>oConn.Open "Provider=MS Remote;" &amp; _<BR>          "Remote 
              Server=http://myServerName;" &amp; _ <BR>          "Remote 
              Provider=MSDASQL;" &amp; _<BR>          "DSN=myDatabaseName;" 
              &amp; _<BR>          "Uid=myUsername;" &amp; _<BR>          
              "Pwd=myPassword;" </P>
              <P>If you want to use an OLE DB Provider on the remote 
machine:</P>
              <P>oConn.Open "Provider=MS Remote;" &amp; _ <BR>          "Remote 
              Server=http://myServerName;" &amp; _<BR>          "Remote 
              Provider=SQLOLEDB;" &amp; _<BR>         "Data 
              Source=myServerName;" &amp; _<BR>         "Initial 
              Catalog=myDatabaseName;" &amp; _<BR>         "User ID=myUsername;" 
              &amp; _<BR>          "Password=myPassword;"</P>
              <P>If you want to use an OLE DB Provider on the remote machine 
              (via RDS DataFactory Default Handler):</P>
              <P>oConn.Open "Provider=MS Remote;" &amp; _ <BR>          "Remote 
              Server=http://myServerName;" &amp; _ <BR>         
               "Handler=MSDFMAP.Handler;" &amp; _<BR>          "Data 
              Source=MyPubsConn;" </P>
              <P>The corresponding entry in the \winnt\Msdfmap.ini file would 
              be:</P>
              <P>[connect MyPubsConn]<BR>Access = ReadWrite<BR>Connect = 
              "Provider=SQLOLEDB;" &amp; _<BR>        "Data 
              Source=myServerName;" &amp; _<BR>        "Initial 
              Catalog=myDatabaseName;" &amp; _<BR>        "User ID=myUsername;" 
              &amp; _<BR>        "Password=myPassword;"</P>
              <P>For more information, see: Microsoft OLE DB Remoting Provider  
              and Q240838</P>
              <P><BR></P>
              <P>Data Shape Provider Connections<BR>MS DataShape - SQL Server 
              <BR>  <BR>oConn.Open "Provider=MSDataShape;" &amp; _<BR>          
              "Data Provider=SQLOLEDB;" &amp; _<BR>          "Data 
              Source=mySQLServerName;" &amp; _<BR>          "Initial 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -