|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
http://www.erpbus.net/access/topic.asp?topic_id=10119&forum_id=84&CurPage=2
OLE DB Provider for Microsoft Jet
For standard security
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\myDb.mdb;" & _
"User Id=admin;" & _
"Password="
If using a Workgroup (System Database)
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:System Database=MySystem.mdw", _
"myUsername", "myPassword"
Note, remember to convert both the MDB and the MDW to the 4.0
database format when using the 4.0 OLE DB Provider.
If MDB has a database password
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:Database Password=MyDbPassword", _
"myUsername", "myPassword"
If want to open up the MDB exclusively
oConn.Mode = adModeShareExclusive
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\myDb.mdb;" & _
"User Id=admin;" & _
"Password="
If MDB is located on a network share
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\\myServer\myShare\myPath\myDb.mdb"
If MDB is located on a remote machine
- Or use an XML Web Service via SOAP Toolkit or ASP.NET
- Or upgrade to SQL Server and use an IP connection string
- Or use an ADO URL with a remote ASP web page
- Or use a MS Remote or RDS connection string
If you don't know the path to the MDB (using ASP)
<% ' ASP server-side code
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath(".") & "\myDb.mdb;" & _
"User Id=admin;" & _
"Password="
%>
This assumes the MDB is in the same directory where the ASP page is running. Also make sure this directory has Write permissions for the user account.
If you don't know the path to the MDB (using VB)
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\myDb.mdb;" & _
"User Id=admin;" & _
"Password="
This assumes the MDB is in the same directory where the application is running.
You can also open an Excel Spreadsheet using the JET OLE DB Provider
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mySpreadsheet.xls;" & _
"Extended Properties=""Excel 8.0;HDR=Yes"""
Where "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. |
|