Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

ADO LockType 属性


❮ 记录集对象完整参考

LockType 属性设置或返回一个 LockTypeEnum 值,该值指定在编辑记录集中的记录时使用的锁定类型。默认值为 adLockReadOnly。此属性在关闭的记录集上是可读写的,在打开的记录集上是只读的。

注意:在打开记录集之前设置此属性。

注意:并非所有提供程序都支持所有锁定类型。如果请求的 LockType 设置不受支持,提供程序将选择另一种锁定类型。您可以使用 Supports 方法来确定记录集对象中可用的实际锁定功能。

注意:如果 CursorLocation 设置为 adUseClient,则不支持 adLockPessimistic。


语法

objRecordset.LockType

示例

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("northwind.mdb"))
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT * FROM Customers"

rs.CursorLocation=adUseClient
rs.CursorType=adOpenStatic
rs.LockType=adLockBatchOptimistic

rs.Open sql,conn

rs.Close
conn.Close
%>

LockTypeEnum 值

常量 描述
adLockUnspecified -1 未指定的锁定类型。克隆从原始记录集继承锁定类型。
adLockReadOnly 1 只读记录
adLockPessimistic 2 悲观锁定,逐条记录。提供程序在编辑后立即锁定记录
adLockOptimistic 3 乐观锁定,逐条记录。提供程序仅在调用更新时锁定记录
adLockBatchOptimistic 4 乐观批量更新。批量更新模式所需

❮ 记录集对象完整参考
×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.