当前记录集不支持更新。这可能是提供程序的限制,也可能是选定锁定类型的限制。 15
<%SetcmdTemp=Server.CreateObject("ADODB.Command")SetInsertCursor=Server.CreateObject(...
<%
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set InsertCursor = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText = "SELECT top 1 * FROM orders order by id desc"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = conn
InsertCursor.Open cmdTemp, , 3, 3
InsertCursor.addnew
if session("user_name")<>"" then
InsertCursor("user_id") =session("user_name")
else
InsertCursor("user_id") ="非会员"
end if
InsertCursor("customerName") =Request("customerName")
InsertCursor("address") =Request("address")
InsertCursor("code") =Request("code")
InsertCursor("phone") =Request("phone")
InsertCursor("email") =Request("email")
InsertCursor("payment") =Request("payment")
InsertCursor("remark") =Request("remark")
InsertCursor.update
InsertCursor.close
sql="select top 1 * from orders order by id desc"
set rs=conn.execute (sql)
if rs.eof or err then
response.write "数据库操作失败,请<a href='Javascript:window.history.go(-1)'>返回</a>"
response.End
else
orderID=rs("id")
end if
set InsertCursor=nothing
productList=session("productList")
If Len(productList) <>0 Then
quantityArray = Split(session("quantityList"), ", ")
productArray = Split(session("productList"), ", ")
for i=0 to UBound(productArray)
set rs=server.createobject("adodb.recordset")
sql = "Select * From hw where g_id="&productArray(i)
rs.open sql,conn,1,1
if Not rs.EOF or err then
If quantity <= 0 Then quantity = 1
sql = "INSERT INTO orderDetail (orderID, productID, productName, price,quantity) "
sql = sql & "VALUES( "& orderID & ","
sql = sql & productArray(i) &",'"
sql = sql & rs("g_name")& "','"
sql = sql & rs("g_cash")& "',"
sql = sql & quantity&")"
' response.write sql
Conn.Execute(sql)
sql="update goods set g_buys=g_buys+1 where g_id="&productArray(i)
conn.execute (sql)
end if
next
end if
%> 展开
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set InsertCursor = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText = "SELECT top 1 * FROM orders order by id desc"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = conn
InsertCursor.Open cmdTemp, , 3, 3
InsertCursor.addnew
if session("user_name")<>"" then
InsertCursor("user_id") =session("user_name")
else
InsertCursor("user_id") ="非会员"
end if
InsertCursor("customerName") =Request("customerName")
InsertCursor("address") =Request("address")
InsertCursor("code") =Request("code")
InsertCursor("phone") =Request("phone")
InsertCursor("email") =Request("email")
InsertCursor("payment") =Request("payment")
InsertCursor("remark") =Request("remark")
InsertCursor.update
InsertCursor.close
sql="select top 1 * from orders order by id desc"
set rs=conn.execute (sql)
if rs.eof or err then
response.write "数据库操作失败,请<a href='Javascript:window.history.go(-1)'>返回</a>"
response.End
else
orderID=rs("id")
end if
set InsertCursor=nothing
productList=session("productList")
If Len(productList) <>0 Then
quantityArray = Split(session("quantityList"), ", ")
productArray = Split(session("productList"), ", ")
for i=0 to UBound(productArray)
set rs=server.createobject("adodb.recordset")
sql = "Select * From hw where g_id="&productArray(i)
rs.open sql,conn,1,1
if Not rs.EOF or err then
If quantity <= 0 Then quantity = 1
sql = "INSERT INTO orderDetail (orderID, productID, productName, price,quantity) "
sql = sql & "VALUES( "& orderID & ","
sql = sql & productArray(i) &",'"
sql = sql & rs("g_name")& "','"
sql = sql & rs("g_cash")& "',"
sql = sql & quantity&")"
' response.write sql
Conn.Execute(sql)
sql="update goods set g_buys=g_buys+1 where g_id="&productArray(i)
conn.execute (sql)
end if
next
end if
%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询