疯狂世界 吉他谱:关于一段ASP代码 请大虾帮看看哪儿不对~~~~

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 22:56:08
<%

dim rs
dim rs2
if m_status = 2 then
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_constr_STRING
rs.Source = "SELECT * FROM order_info WHERE order_id = '"+m_orderid+"'"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()

Set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.ActiveConnection = MM_constr_STRING
rs2.Source = "SELECT * FROM cardNoInfo WHERE state=false and card_id = '"+getOrderInfo_rs("card_id")+"'"
rs2.CursorType = 0
rs2.CursorLocation = 2
rs2.LockType = 1
rs2.Open()
%>
<%
dim i
for i=1 to rs2("card_num")

<tr>
<td width="140" bgcolor="#FFFFFF"><div align="right">卡 号</div></td>
<td width="437" bgcolor="#FFFFFF"><%=rs2("cardno")%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="right">密 码</div></td>
<td bgcolor="#FFFFFF"><%=rs2("cardpwd")%></td>
</tr>

next
%>
<%
dim rs3
dim com
Set com = Server.CreateObject("ADODB.Command")
com.ActiveConnection = MM_constr_STRING
com.CommandText = "update cardNoInfo set state=true,order_id='"+m_orderid+"' where id="+cstr(rs2("id"))
com.Execute
com.ActiveConnection.Close
set com=nothing

Set rs3 = Server.CreateObject("ADODB.Recordset")
rs3.ActiveConnection = MM_constr_STRING
rs3.Source = "SELECT * FROM MakeCardInfo WHERE card_no='"+rs2("cardno")+"' and card_pwd = '"+rs2("cardpwd")+"'"
rs3.CursorType = 0
rs3.CursorLocation = 2
rs3.LockType = 1
rs3.Open()
if not rs3.eof then
Set com = Server.CreateObject("ADODB.Command")
com.ActiveConnection = MM_constr_STRING
com.CommandText = "update MakeCardInfo set isfill=true,userId="+cstr(session("userid"))+",fillDate=#"+cstr(now())+"#,userName='"+session("username")+"' where card_no='"+rs2("cardno")+"' and card_pwd = '"+rs2("cardpwd")+"'"
com.Execute
com.ActiveConnection.Close
set com=nothing
end if
rs3.close
set rs3=nothing
rs2.movenext
next

Set com = Server.CreateObject("ADODB.Command")
com.ActiveConnection = MM_constr_STRING
com.CommandText = "update order_info set successState=true where order_id='"+m_orderid+"'"
com.Execute
com.ActiveConnection.Close
set com=nothing

Set com = Server.CreateObject("ADODB.Command")
com.ActiveConnection = MM_constr_STRING
com.CommandText = "update CardInfo set buy_num=buy_num+"+cstr(rs("card_num"))+" where id='"+getOrderInfo_rs("card_id")+"'"
com.Execute
com.ActiveConnection.Close
set com=nothing
'%>

不知道

Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_constr_STRING
rs.Source = "SELECT * FROM order_info WHERE order_id = '"+m_orderid+"'"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()

以上程序太罗嗦了这样写好点:
Set rs = Server.CreateObject("ADODB.Recordset")
mysql = "SELECT * FROM order_info WHERE order_id = '" & m_orderid & "'"
rs.Open MM_constr_STRING,mysql,1,2

你的数据库中 ID 是不是全不都是字符类型,我看你的所有 ID 都加了"'",你自己检查一下数据库和sql语句中的类型是否一致!