Before you begin you should check to make sure that you have MDAC v2.1 SP2 or later installed on yourserver. To get the latest MDAC goto http://www.microsoft.com/data. If you are unsure which version of MDAC you have installed Microsoft provides a tool called ComCheck which will tell you.
A basic OLEDB Connection String looks like this:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\db1.mdb"
Of course you will have to replace the path above ("c:\db1.mdb") with the path and filename of your own database. If the database is located on an ISP's server and you don't know the physical path of your database you can use the Server.Mappath() function. Eg:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("/db1.mdb") However it is not recommended that you place your database in a folder that has IIS read permissions enabled (as any casual web-browser will be able to download the file if the filename is known).
It is recommended that you assign your connection string to an application level global variable or create an include file that contains code that assigns the connection string to a local variable (with the include file being included on each page that requires a database connection). This way if your database ever changes you only need to make one change to your code to enable it to connect to your new database.
Eg (in your global.asa):
Sub Application_OnStart
Application("strDBConnectionString") = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\db1.mdb"
End Sub
You may need to specify additional parameters for the connection string (eg a User ID and Password, if you have placed a UserName/Password restriction on the database).
The following is a list of additional parameters that can go into the connection string. Each parameter takes the form of:
parameter name=value
and is separated from the next parameter by a ;
User ID (default: User ID=Admin)
Password (default: Password="")
Mode
Extended Properties
Jet OLEDB:System
Jet OLEDB:Registry Path
Jet OLEDB:Database Password
Jet OLEDB:Engine Type
Jet OLEDB:Database Locking Mode
Jet OLEDB:Global Partial Bulk Ops
Jet OLEDB:Global Bulk Transactions
Jet OLEDB:New Database Password
Jet OLEDB:Create System Database
Jet OLEDB:Encrypt Database
Jet OLEDB:Don't Copy Locale on Compact
Jet OLEDB:Compact Without Replica Repair
Jet OLEDB:SFP
For a comprehensive list of connection strings (Access or otherwise) check out this page over at Able
Consulting.Web: http://www.qqread.com/asp/b262458001.html
相关图文阅读
频道图文推荐
健 康 咨 询
时 尚 咨 询
相关专题
- Access (858篇文章)
- 数据库专栏 (5162篇文章)
- 数据库处理专题 (8676篇文章)
- 城域网专题 (7831篇文章)
- 数据库安全技术专题 (13167篇文章)
- 数据库安装与卸载 (10539篇文章)
- Linux数据库宝典 (13147篇文章)
- Access安装配置 (14篇文章)
- 数据库相关文章 (5162篇文章)
- asp检测文件编码 (0次浏览)
- ASP发送邮件的class(完) (0次浏览)
- Asp常见问题(新手) (0次浏览)
- asp编译成dll-图形化教程 (0次浏览)
- ASP编程入门进阶 (0次浏览)
- Asp备份与恢复SQL Server数据库 (0次浏览)
- Asp+的几个特点 (0次浏览)
- ASP:在结果中搜索 (0次浏览)
- asp 中对 ip 进行过滤限制函数 (0次浏览)
- ASP 指南 (0次浏览)



