设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 31|回复: 1
打印 上一主题 下一主题

[求助]为什么查询结果总只能得到最后一个值的数据??

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-14 06:24:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
请帮我看看代码中间那里要怎么改.......谢谢.....

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/conn.asp"-->
<!-- #include file="inc/checklogin.asp"-->
<!--#include file="inc/md5.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>edit manage</title>
<link href="inc/style.css" rel="stylesheet" type="text/css">
<script src="inc/setDate.js"></script>
<script language="javascript">
function check()
{
if( window.myform.Customername.value==""){alert("pleas input Customername");return false}
if( window.myform.Address.value==""){alert("please input Address");return false}
if( window.myform.State.value==""){alert("please input State");return false}
if( window.myform.Tel.value==""){alert("please input Tel");return false}
if( window.myform.Zip_code.value==""){alert("please input Zip_code");return false}
if( window.myform.Purchasedate.value==""){alert("please input Purchasedate");return false}
if( window.myform.Purchaseloaction.value==""){alert("please input Purchaseloaction");return false}
if( window.myform.invoiceno.value==""){alert("please input invoiceno");return false}
if( window.myform.bigclass.value==""){alert("please input bigclass");return false}
if( window.myform.smallclass.value==""){alert("please input smallclass");return false}
if( window.myform.product.value==""){alert("please input product");return false}
if( window.myform.item.value==""){alert("please input item");return false}
if( window.myform.num.value==""){alert("please input num");return false}
quan=window.myform.num.value;
for (nIndex=0; nIndex<quan.length; nIndex++)
{
cCheck = quan.charAt(nIndex);
if (!IsDigit(cCheck))
{
alert("num must be a number");
return false;
}
}
if( window.myform.reason.value==""){alert("please input reason");return false}
if( window.myform.shipdate.value==""){alert("please input shipdate");return false}
document.all.myform.submit();
}
function IsDigit(cCheck)
{
return (('0'<=cCheck) && (cCheck<='9'));
}


function selectitem()
{ document.all.myform.action="selectitem.asp";
document.all.myform.submit();
}

function submitt()
{ document.all.myform.action="addcustomer.asp?action=add";
check();
}
</script>
</head>
<% set ds=server.CreateObject("adodb.recordset")
ds.open "select * from customer order by customerno desc",conn,3,3
if ds.eof then
tempno=1
else
tempno=cint(ds("customerno"))+1
end if
if len(tempno)<5 then
i=5-len(tempno)
for j=1 to i
tempno="0"&cstr(tempno)
next
end if
ds.close
%>
<body>
<p>&nbsp;</p>
<table width="629" border="0" cellspacing="1" cellpadding="3" align="center" class="table">
<form name="myform" action="" method="post" onSubmit="return check()">
<tr>
<td width="134" align="right">Date:</td>
<td colspan="3"><input type="text" name="date" value="<%=formatdatetime(now(),2)%>"></td>
</tr>

<tr>
<td align="right" width="134">Customer NO.: </td>
<td colspan="3"><input type="text" name="customerno" value="<%=tempno%>"></td>
</tr>
<tr>
<td align="right" width="134">Customer name: </td>
<td colspan="3"><input name="Customername" type="text" id="Customername" value="<%=request("Customername")%>"></td>
</tr>
<tr>
<td align="right" width="134">Address:</td>
<td width="168"><input name="Address" type="text" id="Address" value="<%=request("Address")%>">
</td>
<td align="right" width="92"> State:</td>
<td width="206"><input name="State" type="text" id="State" value="<%=request("State")%>"></td>
</tr>
<tr>
<td align="right" width="134">Tel:</td>
<td><input name="Tel" type="text" id="Tel" value="<%=request("Tel")%>">
</td>
<td align="right">Zip_code:</td>
<td><input name="Zip_code" type="text" id="Zip_code" value="<%=request("Zip_code")%>"></td>
</tr>
<tr>
<td align="right" width="134">Purchase date: </td>
<td colspan="3"><input name="Purchasedate" type="text" id="Purchasedate" onfocus=setday(this) value="<%=request("Purchasedate")%>"></td>
</tr>
<tr>
<td align="right" width="134">Purchase loaction: </td>
<td colspan="3"><input name="Purchaseloaction" type="text" id="Purchaseloaction" value="<%=request("Purchaseloaction")%>"></td>
</tr>
<tr>
<td align="right" width="134">invoice no:</td>
<td colspan="3"><input name="invoiceno" type="text" id="invoiceno2" value="<%=request("invoiceno")%>"></td>
</tr>
<tr>
<td align="right" width="134">Purchase Product item: </td>
<td colspan="3"><select name="bigclass" onChange="selectitem()">
<option value="">select big class</option>
<% set rs1=server.CreateObject("adodb.recordset")
rs1.open "select * from bigclass",conn,3,3
do while not rs1.eof
%>
<option value="<%=rs1("bigclassid")%>" <%if request("bigclass")<>"" then if cint(trim(rs1("bigclassid")))=cint(trim(request("bigclass"))) then response.Write("selected") end if end if%>><%=rs1("bigclassname")%></option>
<% rs1.movenext
loop%>
</select>
<select name="smallclass" onChange="selectitem()">
<option value="">select small class</option>
<% if request("bigclass")<>"" then
set rs2=server.CreateObject("adodb.recordset")
rs2.open "select * from smallclass where bigclassid="&cint(trim(request("bigclass")))&"",conn,3,3
do while not rs2.eof%>
<option value="<%=rs2("smallclassid")%>" <%if request("smallclass")<>"" then if cint(trim(rs2("smallclassid")))=cint(trim(request("smallclass"))) then response.Write("selected") end if end if%>><%=rs2("smallclassname")%></option>
<% rs2.movenext
loop
end if
%>
</select>

<select name="product" onChange="selectitem()">
<option value="">select product</option>
<%
if request("smallclass")<>"" then
set rs3=server.CreateObject("adodb.recordset")
rs3.open "select * from product where smallclassid="&cint(trim(request("smallclass")))&"",conn,3,3
do while not rs3.eof
%>
<option value="<%=rs3("productid")%>" <%if request("product")<>"" then if cint(trim(rs3("productid")))=cint(trim(request("product"))) then response.Write("selected") end if end if%>><%=rs3("productname")%></option>
<%rs3.movenext
loop
end if%>
</select>

<!-- <select name="item" onChange="selectitem()">
<option value="">select item</option>
<%
if request("product")<>"" then
set rs4=server.CreateObject("adodb.recordset")
rs4.open "select * from item where productid="&cint(trim(request("product")))&"",conn,3,3
do while not rs4.eof
%>
<option value="<%=rs4("itemid")%>"
<%if request("item")<>"" then
if cint(trim(rs4("itemid")))=cint(trim(request("item"))) then
itemn=trim(rs4("itemname"))
response.Write("selected")
end if
end if%>><%=rs4("ino")%></option>
<%rs4.movenext
loop
end if%>
</select> <input type="text" value="<% if request("item")<>"" then response.Write(itemn) end if%>" size="12">-->
</td>
</tr>
<tr>
<td align="right" width="134">Defective Reason: </td>
<td colspan="3"><select name="reason" onChange="selectitem()">
<option value="">select reason</option>
<% if request("product")<>"" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from product where productid="&cint(trim(request("product")))&"",conn,3,3
reason=rs("reason")
if reason<>"" then
k=cint(ubound(Split(reason,",")))
dsql="select distinct * from reason where reasonid="&cint(split(reason)(0))
for i=1 to k
dsql=dsql&" or reasonid="&cint(split(reason)(i))
next
您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-20 13:29 , Processed in 0.101362 second(s), 9 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表