对象关闭时,不允许操作
set cmdObj = server.CreateObject("adodb.command")
set rs = server.CreateObject("adodb.recordset")
cmdObj.CommandText = "select top 1 * from Inward order by InwardID desc"
cmdObj.CommandType = 4
err.Clear()
on error resume next
'向入库记录中添加数据
conn.BeginTrans
set cmdObj.ActiveConnection = conn
'set rs=server.CreateObject("adodb.recordset")
rs.Open cmdObj,, adOpenStatic, adLockOptimistic
'向表中添加数据
rs.AddNew
rs("InwardDate")=inwa_date
rs("inw_FactDate")=inwa_fact_date
rs("Inw_DcID")=dc_id
rs("InwardNo")=inwa_no
rs("ProdID")=prod_id
rs("Inw_Categ")=categ_id
rs("ChargePerson")=inwa_contact
rs("Inw_Option")=User
rs("InwRemark")=inwa_beizu
rs("Inw_State")=inwa_stat
rs.Update
rs.close
set rs = nothing
'将数据添加到库存中
strSQL = "select * from Inventory where InveDate >=#"&start_date&"# and InveDate< #"&end_date&"# and Inve_DcID="&dc_id&" and Inve_CategID="&categ_id&" and Inve_ProdID="&prod_id&""
'set rs2 = conn.execute(strSQL)
set rs = conn.execute(strSQL)
if err then
Response.Write err.Description
conn.RollbackTrans()
Response.Write "数据库操作失败,请<a href='javascript:window.history(-1)'>返回</a>"
Response.End
end if
在运行到这段程序之前,并没有建立任何对象,但是在这段程序运行后总是出错,“对象关闭时不允许操作,数据库操作失败,请返回”