当前位置: 首页 > 网络学院 > 服务端脚本教程 > ADO > ADO OriginalValue 与 Underlyin

ADO
ADO DataTypes
ADO 摘要
ADO 实例

ADO OriginalValue 与 Underlyin


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 377 ::
收藏到网摘: n/a

The OriginalValue property returns a variant that contains the field value as it existed right after the last Update or UpdateBatch method call.
OriginalValue属性的作用是:返回在发生任何更改前(即自从上次调用 Update 方法或UpdateBatch方法)已经存在的字段值。

The UnderlyingValue property returns a variant that contains the current value of a field. This value does not necessarily show changes made by other users and may not be the latest value.
UnderlyingValue属性的作用是:返回当前字段值。该值不显示其它用户的更改信息,且它不显示更新后的值。

Tip: Use the Resync property of the Recordset object to get the latest values for all of the Field objects in the Fields Collection.
提示:可以使用Recordset对象中的Resync属性获取字段集中最新的字段对象值。

Tip: These properties can be used together to prevent update conflicts.
提示:同时使用这些属性可以避免更新时发生冲突。

Syntax
语法

objField.OriginalValue
objField.UnderlyingValue

Example
案例

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
set rs = Server.CreateObject("ADODB.Recordset")
rs.open "customers", conn
set objfield=rs.fields("companyname")
'Some code..................
'Check for changes
rs.movefirst
while rs.eof=false if objfield.OriginalValue<>objfield.UnderlyingValue then response.write("Data has changed!<br />") response.write("Original value: ") response.write(objfield.OriginalValue & "<br />") response.write("Current value: ") response.write(objfield.UnderlyingValue & "<br />") end if rs.movenext
next
'More code...................
rs.Close
conn.close
%>

评论 (0) All

登陆 | 还没注册?