事务问题,提示我multiple recordsets .请高手指教...
set Errors=oConn.Errors
oConn.BeginTrans
sql = "Insert into E_Order (UserName,Company,Province,City,CompanyAddr,PostCode,Tel,Mobile,Contactor,Trans,createdDate) values('"&session("UserName")&"','"&request("Company")&"','"&request("province")&"','"&request("city")&"','"&request("companyaddr")&"','"&request("postcode")&"','"&request("tel")&"','"&request("mobile")&"','"&request("name")&"',"&request("trans")&",'"&Now()&"')"
oConn.execute(sql)
Set rs = oConn.Execute("SELECT SCOPE_IDENTITY() as newIDValue FROM E_Order")
newID = rs("newIDValue")
sql = "select UserName,productID,ProductCount from E_Cart where UserName='"&session("UserName")&"' order by createdDate desc"
Set rs1 = oConn.execute(sql)
While Not rs1.eof
sql1 = "insert into E_OrdertoProduct (OrderID,UserName,productID) values(" & newID & ",'"&session("UserName")&"'," & rs1("productID") &""
oConn.execute(sql1)
Wend
if Errors.Count > 0 then
oConn.RollbackTrans
oConn.close
' Response.Redirect ".asp"
response.write "rollback!"
else
oConn.commitTrans
oConn.close
response.write "commit"
End if
以上代码执行完,系统报错如下:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
Transaction cannot have multiple recordsets with this cursor type. Change the cursor type, commit the transaction, or close one of the recordsets.
/staff/serv/eBu/orderConfirm.asp, line 196
这里的196行就是我标红的那一行.但我必须要用查询啊..
有什么办法可以解决吗??
谢谢啦!!!