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

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

2004/11/7 4:11:00作者:蓝点我要评论(0)

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.

阅读本文后您有什么感想? 已有

0

人给出评价!

024438815073bcc80210411d318f5f448.gif576b6d02b31ab14c684a7a87b44a9cee.gif

024438815073bcc80210411d318f5f448.giff7305c7c0b36b0d4b0b0d5a6d6976221.gif

恶心

024438815073bcc80210411d318f5f448.gif8aa4af143b3835e18758228b704a277a.gif

期待

024438815073bcc80210411d318f5f448.gif29528662c1ea79765fb923e0b64e8d11.gif

难过

024438815073bcc80210411d318f5f448.gif95b66fd42cb0ce787490a48ec9231efe.gif

不错

024438815073bcc80210411d318f5f448.gifd0fe0251ccdd3860eacd5c49c4e3e7c3.gif

关注

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值