国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

設(shè)置只有管理員才能改變AllowBypassKey屬性

2024-07-21 02:12:32
字體:
供稿:網(wǎng)友

最大的網(wǎng)站源碼資源下載站,

tmtony翻譯:

在access的幫助文件中說明createproperty 方法的語法:

set property = object.createproperty (name, type, value, ddl)
其實最后一個參數(shù)是這個解釋的(部分描述):

ddl 可選. 一個變量(邏輯子類型) 指定這個屬性是否為ddl對象. 缺少值為false. 如果設(shè)置為true,除非他有 dbsecwritedef 權(quán)限,用戶就不能改變或刪除這個屬性
createproperty 是用來創(chuàng)建或設(shè)置 allowbypasskey 屬性如果這個屬性設(shè)為true, 那就可以禁用戶近shift鍵來禁止啟動屬性和autoexec 宏. 然而,access幫助中提供的例子沒有使用第四個 ddl 參數(shù). 這意味著任何人都可以打開數(shù)據(jù)據(jù)然后用程序復(fù)位allowbypasskey 屬性.

所以,為了限制普通用戶去改變這個屬性,所以我們設(shè)置第四個參數(shù)為true 。

為了對比,我們也同時列出了access本身的例子以便參照

' *********** code start ***********
function changepropertyddl(stpropname as string, _
proptype as dao.datatypeenum, vpropval as variant) _
as boolean
' uses the ddl argument to create a property
' that only admins can change.
'
' current createproperty listing in access help
' is flawed in that anyone who can open the db
' can reset properties, such as allowbypasskey
'
on error goto changepropertyddl_err

dim db as dao.database
dim prp as dao.property

const conpropnotfounderror = 3270

set db = currentdb
' assuming the current property was created without
' using the ddl argument. delete it so we can
' recreate it properly
db.properties.delete stpropname
set prp = db.createproperty(stpropname, _
proptype, vpropval, true)
db.properties.append prp

' if we made it this far, it worked!
changepropertyddl = true

changepropertyddl_exit:
set prp = nothing
set db = nothing
exit function

changepropertyddl_err:
if err.number = conpropnotfounderror then
' we can ignore when the prop does not exist
resume next
end if
resume changepropertyddl_exit
end function

幫助本身的例子
function changeproperty(strpropname as string, _
varproptype as variant, varpropvalue as variant) as integer
' the current listing in access help file which will
' let anyone who can open the db delete/reset any
' property created by using this function, since
' the call to craeteproperty doesn't use the ddl
' argument
'
dim dbs as database, prp as property
const conpropnotfounderror = 3270

set dbs = currentdb
on error goto change_err
dbs.properties(strpropname) = varpropvalue
changeproperty = true

change_bye:
exit function

change_err:
if err = conpropnotfounderror then ' property not found.
set prp = dbs.createproperty(strpropname, _
varproptype, varpropvalue)
dbs.properties.append prp
resume next
else
' unknown error.
changeproperty = false
resume change_bye
end if
end function
' *********** code end ***********
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 阿克苏市| 金堂县| 波密县| 武穴市| 神木县| 潞西市| 敦煌市| 上饶市| 牙克石市| 竹山县| 安龙县| 托克托县| 高尔夫| 西畴县| 新安县| 阳山县| 昌邑市| 平阴县| 陈巴尔虎旗| 富平县| 东乡族自治县| 定襄县| 黄龙县| 南华县| 古蔺县| 湟中县| 陇南市| 灵石县| 海门市| 东明县| 佛山市| 新建县| 宣武区| 禄丰县| 阿拉善左旗| 毕节市| 丰宁| 左云县| 徐汇区| 濮阳市| 长沙县|