请问一个查询数据的问题 ASP ACCESS
table a ,字段 a , 数字型
有一条记录
为什么 update 后, 查询的结果是 原来旧结果, 不是新结果呢 ?
为什么 oldqty= newqty 呢?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/note.asp" -->
<!--#include file="Connections/conn.asp" -->
<%
response.ContentType="text/xml"
response.write("<?xml version='1.0' encoding='gb2312'?>")
response.write("<root>")
Dim MM_editCmd
Dim Recordset
Set Recordset = Server.CreateObject("ADODB.Recordset")
Recordset.ActiveConnection = MM_conn_STRING
Recordset.Source = "select a from a"
Recordset.CursorType = 0
Recordset.CursorLocation = 3 'Recordset.RecordCount
Recordset.LockType = 1
Recordset.Open()
'取旧结果
dim oldqty
oldqty=Recordset.Fields.Item("a").Value
response.write("<oldqty>" & oldqty & "</oldqty>")
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_conn_STRING
'更新
MM_editCmd.CommandText = "update a set a=a-1"
MM_editCmd.Execute
' 检查
Recordset.close()
Recordset.Source = "select a from a"
Recordset.CursorType = 0
Recordset.CursorLocation = 2 'Recordset.RecordCount
Recordset.LockType = 1
Recordset.Open()
dim newqty
newqty=Recordset.Fields.Item("a").Value
response.write("<newqty>" & newqty & "</newqty>")
MM_editCmd.ActiveConnection.Close
Recordset.Close()
Set Recordset = Nothing
response.write("</root>")
%>