网络学院 w3pop社区 网络资源 IT新闻

w3pop.com :: 网络学院 :: ADO :: ADO OriginalValue 与 Underlyin

会员登陆

帐号

密码

回答

记住密码

忘记密码? 注册

ADO OriginalValue 与 Underlyin


作者:w3pop.com 翻译/整理:w3pop.com 发布:2007-04-28 浏览:1124 :: ::

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