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

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

📁 较为详细的介绍了asp自定义的各种函数,方便asp的各种开发.
💻 HTM
📖 第 1 页 / 共 5 页
字号:
              Driver=Sybase SQL Anywhere 5.0;" &amp; _<BR>          
              "DefaultDir=c:\dbpath\;" &amp; _<BR>          
              "Dbf=c:\sqlany50\mydb.db;" &amp; _<BR>         "Uid=myUsername;" 
              &amp; _<BR>          "Pwd=myPassword;"<BR>          
"Dsn="""";"</P>
              <P>Note: Including the DSN tag with a null string is absolutely 
              critical or else you get the dreaded -7778 error.</P>
              <P>For more information, see: Sybase SQL Anywhere User Guide</P>
              <P></P>
              <P>ODBC Driver for Teradata <BR>  <BR>oConn.Open 
              "Provider=Teradata;" &amp; _<BR>          "DBCName=MyDbcName;" 
              &amp; _ <BR>          "Database=MyDatabaseName;" &amp; _ 
              <BR>          "Uid=myUsername;" &amp; _<BR>          
              "Pwd=myPassword;"</P>
              <P>For more information, see Teradata ODBC Driver</P>
              <P></P>
              <P>ODBC Driver for Text <BR>  <BR>oConn.Open "Driver={Microsoft 
              Text Driver (*.txt; *.csv)};" &amp; _<BR>          
              "Dbq=c:\somepath\;" &amp; _<BR>          
              "Extensions=asc,csv,tab,txt;" &amp; _<BR>          "Persist 
              Security Info=False"</P>
              <P>Note: Specify the filename in the SQL statement. For 
              example:</P>
              <P>oRs.Open "Select * From customer.csv", _<BR>        oConn, 
              adOpenStatic, adLockReadOnly, adCmdText</P>
              <P><BR>For more information, see: Text File Driver Programming 
              Considerations</P>
              <P></P>
              <P>ODBC Driver for Visual FoxPro <BR>  <BR>With a database 
              container:</P>
              <P>oConn.Open "Driver={Microsoft Visual FoxPro Driver};" &amp; 
              _<BR>          "SourceType=DBC;" &amp; _<BR>          
              "SourceDB=c:\somepath\mySourceDb.dbc;" &amp; _<BR>          
              "Exclusive=No;" </P>
              <P>Without a database container (Free Table Directory):</P>
              <P>oConn.Open "Driver={Microsoft Visual FoxPro Driver};" &amp; 
              _<BR>          "SourceType=DBF;" &amp; _<BR>          
              "SourceDB=c:\somepath\mySourceDbFolder;" &amp; _<BR>          
              "Exclusive=No;" <BR></P>
              <P>For more information, see: Visual FoxPro ODBC Driver and 
              Q165492</P>
              <P><BR></P>
              <P>OLE DB Data Link Connections<BR>Data Link File (UDL) <BR>  
              <BR>For Absolute Path:</P>
              <P>oConn.Open "File Name=c:\somepath\myDatabaseName.udl;" </P>
              <P>For Relative Path:</P>
              <P>oConn.Open "File Name=myDatabaseName.udl;"<BR>  </P>
              <P>For more information, see: HOWTO: Use Data Link Files with 
              ADO</P>
              <P>Note: Windows 2000 no longer contains the "New | Microsoft Data 
              Link" menu <BR>anymore. You can add the Data Link menu back in the 
              menu list by running the <BR>"C:\Program Files\Common 
              Files\System\Ole DB\newudl.reg" reg file, <BR>then right-click on 
              the desktop and select "New | Microsoft Data Link" menu.  <BR>Or 
              you can also create a Data Link file by creating a text file and 
              change it's <BR>file extension to ".udl", then double-click the 
              file.</P>
              <P><BR></P>
              <P>OLE DB Provider Connections<BR>OLE DB Provider for AS/400 <BR>  
              <BR>oConn.Open "Provider=IBMDA400;" &amp; _<BR>          "Data 
              source=myAS400;"<BR>          "User Id=myUsername;" &amp; 
              _<BR>          "Password=myPassword;"</P>
              <P>For more information, see:  A Fast Path to AS/400 
              Client/Server</P>
              <P></P>
              <P>OLE DB Provider for Active Directory Service <BR>  
              <BR>oConn.Open "Provider=ADSDSOObject;" &amp; _<BR>          "User 
              Id=myUsername;" &amp; _<BR>          "Password=myPassword;"<BR>  
              </P>
              <P>For more information, see: Microsoft OLE DB Provider for 
              Microsoft Active Directory Service</P>
              <P></P>
              <P>OLE DB Provider for DB2 <BR>  <BR>oConn.Open = 
              "Provider=DB2OLEDB;" &amp; <BR>           "Network Transport 
              Library=TCPIP;" &amp; <BR>           "Network Address=MyServer;" 
              &amp; _<BR>           "Package Collection=MyPackage;" &amp; 
              <BR>           "Host CCSID=1142"<BR>           "Initial 
              Catalog=MyDB;" &amp; <BR>           "User ID=MyUsername;" &amp; 
              _<BR>           "Password=MyPassword;"</P>
              <P>For more information, see: OLE DB Provider for DB2 <BR>and INF: 
              Configuring Data Sources for the Microsoft OLE DB Provider for DB2 
              </P>
              <P></P>
              <P>OLE DB Provider for Index Server <BR>  <BR>oConn.Open 
              "Provider=msidxs;" &amp; _<BR>          "Data 
              source=MyCatalog;"<BR>  </P>
              <P>For more information, see: Microsoft OLE DB Provider for 
              Microsoft Indexing Service</P>
              <P></P>
              <P>OLE DB Provider for Internet Publishing <BR>  <BR>oConn.Open 
              "Provider=MSDAIPP.DSO;" &amp; _<BR>      "Data 
              Source=http://mywebsite/myDir;" &amp; _ <BR>      "User 
              Id=myUsername;" &amp; _<BR>      "Password=myPassword;" <BR> </P>
              <P>For more information, see: Microsoft OLE DB Provider for 
              Internet Publishing and Q245359</P>
              <P></P>
              <P>OLE DB Provider for Microsoft Jet <BR>  <BR>For standard 
              security:</P>
              <P>oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; 
              _<BR>          "Data Source=c:\somepath\myDb.mdb;" &amp; _ 
              <BR>          "User Id=admin;" &amp; _<BR>          
              "Password=;"</P>
              <P>If using a Workgroup (System Database):</P>
              <P>oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; 
              _<BR>          "Data Source=c:\somepath\mydb.mdb;" &amp; _ 
              <BR>          "Jet OLEDB:System Database=MySystem.mdw;", 
              _<BR>          "admin", "" </P>
              <P>Note, remember to convert both the MDB and the MDW to the 4.0 
              database format when using the 4.0 OLE DB Provider.</P>
              <P>If MDB has a database password:</P>
              <P>oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; 
              _<BR>          "Data Source=c:\somepath\mydb.mdb;" &amp; _ 
              <BR>          "Jet OLEDB:Database Password=MyDbPassword;", 
              _<BR>          "admin", ""</P>
              <P>If MDB is located on a network share:</P>
              <P>oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; 
              _<BR>          "Data 
Source=\\myServer\myShare\myPath\myDb.mdb;</P>
              <P>If want to open up the Access database exclusively:</P>
              <P>oConn.Mode = adModeShareExclusive<BR>oConn.Open 
              "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _<BR>          "Data 
              Source=c:\somepath\myDb.mdb;" &amp; _<BR>          "User 
              Id=admin;" &amp; _<BR>          "Password=;"</P>
              <P><BR>For more information, see: OLE DB Provider for Microsoft 
              Jet, Q191754, Q225048, Q239114, and Q271908</P>
              <P></P>
              <P>You can also open an Excel Spreadsheet using the "OLE DB 
              Provider for Microsoft Jet" </P>
              <P>oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; 
              _<BR>          "Data Source=c:\somepath\myExcelSpreadsheet.xls;" 
              &amp; _<BR>          "Extended Properties=""Excel 8.0;HDR=Yes;"";" 
              </P>
              <P>Where "HDR=Yes" means that there is a header row in the cell 
              range <BR>(or named range), so the provider will not include the 
              first row of the<BR>selection into the recordset. If "HDR=No", 
              then the provider will include<BR>the first row of the cell range 
              (or named ranged) into the recordset. </P>
              <P>For more information, see: Q278973<BR></P>
              <P>You can also open a Text File using the "OLE DB Provider for 
              Microsoft Jet" </P>
              <P>oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _ 
              <BR>          "Data Source=c:\somepath\;" &amp; _ <BR>          
              "Extended Properties=""text;HDR=Yes;FMT=Delimited;"";" <BR><BR>' 
              Then open a recordset based on a select on the actual 
              file<BR>oRs.Open "Select * From MyTextFile.txt", oConn, 
              adOpenStatic, adLockReadOnly, adCmdText </P>
              <P>For more information, see: Q262537 </P>
              <P></P>
              <P>OLE DB Provider for ODBC Databases <BR>  <BR>For Access 
              (Jet):</P>
              <P>oConn.Open "Provider=MSDASQL;" &amp; _ <BR>          
              "Driver={Microsoft Access Driver (*.mdb)};" &amp; _<BR>          
              "Dbq=c:\somepath\mydb.mdb;" &amp; _<BR>          "Uid=myUsername;" 
              &amp; _<BR>          "Pwd=myPassword;"</P>
              <P>For SQL Server:</P>
              <P>oConn.Open "Provider=MSDASQL;" &amp; _ <BR>          
              "Driver={SQL Server};" &amp; _<BR>          "Server=myServerName;" 
              &amp; _<BR>          "Database=myDatabaseName;" &amp; 
              _<BR>          "Uid=myUsername;" &amp; _<BR>          
              "Pwd=myPassword;"</P>
              <P>For more information, see: Microsoft OLE DB Provider for 
              ODBC</P>
              <P></P>
              <P>OLE DB Provider for Oracle (from Microsoft) <BR>  
              <BR>oConn.Open "Provider=msdaora;" &amp; _<BR>          "Data 
              Source=MyOracleDB;" &amp; _ <BR>          "User Id=myUsername;" 
              &amp; _<BR>          "Password=myPassword;"</P>
              <P>For more information, see: Microsoft OLE DB Provider for 
              Oracle</P>
              <P></P>
              <P>OLE DB Provider for Oracle (from Oracle) <BR>  <BR>For Standard 
              Security:</P>
              <P>oConn.Open "Provider=OraOLEDB.Oracle;" &amp; _<BR>          
              "Data Source=MyOracleDB;" &amp; _ <BR>          "User 
              Id=myUsername;" &amp; _<BR>          "Password=myPassword;"</P>
              <P>For a Trusted Connection:</P>
              <P>oConn.Open "Provider=OraOLEDB.Oracle;" &amp; _<BR>          
              "Data Source=MyOracleDB;" &amp; _ <BR>          "User Id=/;" &amp; 
              _<BR>          "Password=;"<BR>' Or</P>
              <P>oConn.Open "Provider=OraOLEDB.Oracle;" &amp; _<BR>          
              "Data Source=MyOracleDB;" &amp; _ <BR>          
              "OSAuthent=1;"<BR> </P>
              <P>Note: "Data Source=" must be set to the appropriate Net8 name 
              which is known to the naming method in use. For example, for Local 
              Naming, it is the alias in the tnsnames.ora file; for Oracle 
              Names, it is the Net8 Service Name. </P>
              <P>For more information, see: Connecting to an Oracle 

⌨️ 快捷键说明

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