| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 680 人关注过本帖
标题:[求助]为什么查询结果总只能得到最后一个值的数据??
只看楼主 加入收藏
favoriteran
Rank: 1
等 级:新手上路
帖 子:142
专家分:0
注 册:2006-3-10
收藏
 问题点数:0 回复次数:1 
[求助]为什么查询结果总只能得到最后一个值的数据??

请帮我看看代码中间那里要怎么改.......谢谢.....

<%@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

set ds=server.CreateObject("adodb.recordset")
ds.open dsql,conn,3,3
do while not ds.eof
%>
<option value="<%=ds("reasonid")%>" <%if request("reason")<>"" then if cint(trim(ds("reasonid")))=cint(trim(request("reason"))) then response.Write("selected") end if end if%>><%=ds("reason")%></option>
<%ds.movenext
loop
end if
end if%>
</select></td>
</tr>
<tr>
<td align="right" width="134">Part Description:</td>
<td colspan="3">

<select name="Solution" onChange="selectitem">
<option selected>select Solution</option>
<%
if request("reason")<> "" then
dim rs5,sql5
sql5="select distinct solution.*,item.* from Solution,item where solution.reasonid="&cint(trim(request("reason")))&" and solution.itemid=item.itemid and solution.productid="&cint(trim(request("product")))&""
set rs5=server.CreateObject("adodb.recordset")
rs5.open sql5,conn,3,3
do while not rs5.eof%>
<option value="<%=rs5("Solutionid")%>" select <%
if rs5("reasonid")=cint(trim(request("reason"))) then
response.Write("select")
titem=rs5("itemid")
end if%>><%=trim(rs5("ino"))%></option>
<% rs5.movenext
loop
end if
%>
</select>
<% if request("reason")<>"" then %>
<input name="button" type="button" onClick="window.open('checkstore.asp?item=<%=titem%>','','width=600,height=150')" value="check store">


请大家指点,在这里当我按checkstore查询时,在checkstore.asp中总只能得到solution最后一个值的结果......当我换一个solution值时,得到的还是原来的那个....请问要怎么改才行....


<% end if%> </td>
</tr>
<tr>
<td align="right" width="134">replace number:</td>
<td colspan="3"><input name="num" type="text" id="num" value="<%=request("num")%>"></td>
</tr>
<tr>
<td align="right" width="134">Next Shipping Date: </td>
<td colspan="3"><input name="shipdate" type="text" id="shipdate2" onFocus=setday(this) value="<%=request("shipdate")%>"></td>
</tr>
<tr>
<td align="center" colspan="4"><input type="button" value="submit" onClick="submitt()"></td>
</tr>
</form>
<% if request("product")<>"" then%>
<tr><td colspan="4" align="center">
<%set pic=server.CreateObject("adodb.recordset")
pic.open "select * from product where productid="&cint(trim(request("product")))&"",conn,3,3%>
<a href="<%=trim(pic("picurl"))%>" target="_blank"><img src="<%=trim(pic("picurl"))%>" border="0" width="200"></a>
</td>
</tr>
<% end if%>
</table>

</body>
</html>
<% if request("action")="add" then

if numb<0 then
response.Write("<script>alert('no enough store');selectitem();</script>")
else
set itemn=server.CreateObject("adodb.recordset")
set itemn=nothing
set rs6=server.CreateObject("adodb.recordset")
rs6.open "select * from customer",conn,3,3
rs6.addnew
rs6("customerno")=trim(request("customerno"))
rs6("customername")=trim(request("Customername"))
rs6("address")=trim(request("Address"))
rs6("State")=trim(request("State"))
rs6("tel")=trim(request("tel"))
rs6("Zip_code")=trim(request("Zip_code"))
rs6("ndate")=trim(request("date"))
rs6("purchasedate")=trim(request("Purchasedate"))
rs6("purchaseloaction")=trim(request("Purchaseloaction"))
rs6("invoiceno")=trim(request("invoiceno"))
rs6("productid")=trim(request("product"))
rs6("itemid")=titem
rs6("cnum")=cint(trim(request("num")))
rs6("reasonid")=trim(request("reason"))
rs6("Solutionid")=cint(trim(request("Solution")))
rs6("shipdate")=trim(request("shipdate"))
rs6("issend")=0
rs6("state")=trim(request("state"))
rs6("zip_code")=trim(request("zip_code"))
rs6.update
rs6.close
set rs6=nothing
response.Write("<script>alert('succeed');location.href='addcustomer.asp';</script>")
end if
end if
%>

[此贴子已经被作者于2006-3-15 21:15:48编辑过]

搜索更多相关主题的帖子: 数据 dtd loose include 
2006-03-15 21:12
favoriteran
Rank: 1
等 级:新手上路
帖 子:142
专家分:0
注 册:2006-3-10
收藏
得分:0 
没有高手愿意帮忙看看吗?小弟我感激不尽啊!!!拜托了.......

海納百川,一切從源開始........
2006-03-16 14:13
快速回复:[求助]为什么查询结果总只能得到最后一个值的数据??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022417 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved