样设置为使用OLEDB连接我的Access数据库?

2016-01-29 18:29 50 1 收藏

样设置为使用OLEDB连接我的Access数据库?,样设置为使用OLEDB连接我的Access数据库?

【 tulaoshi.com - ASP 】

  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.

 

来源:http://www.tulaoshi.com/n/20160129/1505980.html

延伸阅读
一、密码式 给数据库起一个随机复杂的名称,避免被猜到被下载,这种方式在以前很流行,因为大家都对自己的代码很有自信。但随着错误提示对数据库地址的泄露导致数据库被非法下载,这种方式也就越来越少人用了。 二、"#"式 在数据库名称里加上#号,从URL上请求时#是请求地址和请求参数的一个分隔字符,如果知道了数据库名...
问:我们单位财务以前用的Access是97版,前不久将Access 97升级至2000版本了。升级完成后出现问题,打开原有的文件后系统提示:“Access 2000无法识别旧版本的数据库文件”,请问有没有办法可以修复数据库? 答:你可以利用软件AccessFix(下载地址为http://www.onlinedown.net/soft/16220.htm)来修复数据库。安装完成后点击按钮“Add ...
使用MIDAS访问远程Access数据库 Allen Tao(http://blog.csdn.net/allentao/) 2005-5-3本文源码下载访问远程数据库常用的办法是使用大型数据库自带的客户端工具,如SQL Server和Oracle等都带有这样的工具。带对于Access这样的小型数据库,这种方法就无法使用了,因为Access不提供这样的客户端工具。但我们可以通过MIDAS实现访问远程Access数据...
适用:ACCESS2000 ACCESS97 数据库规格是MDB的工作极限,以下列出ACCESS2000的规格,与ACCESS97只有极少差异,有差异者皆特别注明。 ●数据库 数据库档案大小 : 20亿字节(ACCESS97为10亿字节) 一个数据库内的组件数目: 32,768 模快 : 1024 一个组件名称的字节数 : 64 一个密码的字节数 : 14 ...
  选择自 kindwell 的 Blog     这几天费了挺大力气在网上查找javascript连接access数据库的方法, 经过整理总结,终于写出一段能够有效执行的代码。       但是这段代码在本地可以正常运行,一旦放到免费个人空间上就没法执 行了,主要原因就是操作权限不够,由于只支持静态页面的免费空间多数都 ...

经验教程

883

收藏

72
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部