asp写入数据库的问题,急急~!~!
AJAX的查询页面
<%
Response.Charset="gb2312"
Dim provider_id,class_id
provider_id=request("nm")
class_id=request("q")
'Response.Write (provider_id)
set rs=server.createobject("adodb.recordset")
sql="select * FROM product where class_id='"&class_id&"' and provider_id='"&provider_id&"' and online=1"
rs.open sql,conn,1,1
If rs.eof Then
Else
response.write ("<table width=""700"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" bordercolor=""#CCCCCC"">")
response.write "<tr><td align=""center"" valign=""middle""><table width=""100%"" border=""1"" align=""center"" cellpadding=""0"" cellspacing=""1"" bordercolor=""#CCCCCC"">"
response.write "<tr><td width=""63"" align=""center"">商品编号</td><td width=""140"" align=""center"">商品名称</td><td width=""288"" align=""center"">规 格</td><td width=""60"" align=""center"" nowrap>单 价(¥)</td><td width=""52"" align=""center"">数 量</td><td width=""76"" align=""center"">小计(¥)</td></tr>"
if not rs.eof then
i=1
do while not rs.eof
response.write ("<tr><td width=""63"" align=""center"">"&rs("product_id")&"")
response.write "<input id=""product_id"" value='"&rs("product_id")&"' type=""hidden""/></td>" '商品编号
response.write ("<td width=""140"" align=""center"">"&rs("product_name")&"</td>")
response.write ("<td width=""288"" align=""center"">"&rs("specification")&"</td>")
response.write ("<td width=""60"" align=""center"">"&rs("price")&"")
response.write "<input name=""price"" id='price"&i&"' value='"&rs("price")&"' type=""hidden""/></td>" '商品编号
response.write ("<td align=""center"" valign=""middle"" nowrap>")
response.write ("<input name=""quantity"" id='"&i&"' value=""0"" type=""text"" onKeyUp=""value=value.replace(/[^\d|]/g,'')"" size=""5"" maxlength=""5"" onBlur=""sum(this)""/>")'商品数量
response.write ("<td width=""76"" align=""center"">")
response.write "<input name=""amount"" id='amount"&i&"' readonly=""true""/></td>"
response.write("</tr>")
i=i+1
rs.movenext
loop
end if
end if
rs.close
conn.close
response.write "</table>"
response.write "<tr><td align=""center"" valign=""middle""><table width=""100%"" border=""1"" align=""center"" cellpadding=""0"" cellspacing=""1"" bordercolor=""#CCCCCC"">"
response.write "<tr><td align=""center"">合 计:</td>"
response.write "<td width=""223"" align=""right"">总 量:<input name=""number_sum"" type=""text"" size=""5"" readonly=""ture"" style=""font:bolder;color:#FF0000""/></td>"
response.write "<td width=""158"" align=""center"">总价:<input name=""amount_sum"" type=""text"" size=""8"" readonly=""ture"" style=""font:bolder;color:#FF0000""/>元</td>"
response.write "</tr>"
response.write "<tr><td align=""center"" valign=""middle"">备注:<span style=""color: #FF0000"">*</span></td>"
response.write "<td colspan=""2"" align=""left"" valign=""middle""><textarea name=""remark"" cols=""52"" rows=""3""></textarea></td>"
response.write "</tr>"
response.write "</table></td>"
response.write "<tr><td height=""22"" colspan=6>"
response.write "</td></tr>"
response.write "</table>"
'%>
在<input name=""quantity""/> 填写数据后提交,把product_id,price,quantity,写入数据库,AJAX查询的记录可能是1条,也可能是10条.