能不能做一个查询功能的ASP网页?(50分)

  • 主题发起人 主题发起人 eagledark
  • 开始时间 开始时间
E

eagledark

Unregistered / Unconfirmed
GUEST, unregistred user!
先建立一个SQL的数据库FAZHENG,里面有一个数据表JILU,共4个字段:
字段名 数据类型
ID VARCHAR
cName VARCHAR
dnum VARCHAR
实现以DNUM字段模糊查询功能,一点查询按钮所有信息显示出来,用ASP怎么实现请教各位!
 
set sql="Select * from jilu where dnum like '%ddddd%'"
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql,conn,3,3;
 
有完整代码吗
 
<!--#include file=&quot;../conn.asp&quot;-->
<%
dim Page '页码
Const Page_RecordCount=15 '每页记录数
dim Total_RecordCount '总记录数
dim Page_Number '页数
%>
<html>
<head>
<title>入库卷烟统计</title>
<meta http-equiv=&quot;Content-Type&quot;
content=&quot;text/html;
charset=gb2312&quot;>
<link rel=&quot;stylesheet&quot;
href=&quot;../splitspace/css.css&quot;
type=&quot;text/css&quot;>
<!--#include file='../calendar.js'-->
</head>
<body bgcolor=&quot;EAF4FE&quot;
text=&quot;#000000&quot;>
<OBJECT Classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WB width=0></OBJECT>
<script language=javascript>
functiondo
PrintSetup(){
WB.ExecWB(8,1)
}
functiondo
PrintPreview(){
WB.ExecWB(7,1)
}
</script>
<table width=&quot;95%&quot;
border=&quot;0&quot;
cellspacing=&quot;0&quot;
cellpadding=&quot;0&quot;
align=&quot;center&quot;>
<tr>
<td height=&quot;145&quot;>
<form name=&quot;form1&quot;
method=&quot;post&quot;
action=&quot;input_anasis.asp?type=1&quot;>

<table width=&quot;100%&quot;
border=&quot;0&quot;
cellspacing=&quot;0&quot;
cellpadding=&quot;0&quot;>
<tr>
<td height=&quot;30&quot;>您现在所在的位置:>><font color=&quot;#990000&quot;>入库卷烟统计</font></td>
</tr>
<tr>
<td height=&quot;22&quot;>
<div align=&quot;center&quot;>
<p><a href=&quot;input_check.asp&quot;><b><font color=&quot;#993300&quot;>入库卷烟查询</font></b></a>   <a href=&quot;input_anasis.asp&quot;><b><font color=&quot;#993300&quot;>入库卷烟统计</font></b></a></p>
</div>
</td>
</tr>
<tr>
<td height=&quot;15&quot;>
<table width=&quot;100%&quot;
border=&quot;0&quot;
cellspacing=&quot;0&quot;
cellpadding=&quot;0&quot;>
<tr>
<td height=&quot;30&quot;>
<table width=&quot;100%&quot;
border=&quot;0&quot;
cellspacing=&quot;0&quot;
cellpadding=&quot;0&quot;>
<tr>
<td width=&quot;9%&quot;
class=&quot;ptd1&quot;
height=&quot;36&quot;>
<div align=&quot;center&quot;></div>
<div align=&quot;center&quot;>入库日期:</div>
</td>
<td width=&quot;33%&quot;
class=&quot;ptd1&quot;
height=&quot;36&quot;>
<input type=&quot;text&quot;
name=&quot;from_date&quot;
size=&quot;15&quot;
style=&quot;border-color: #006600;
border-style:groove;
border-width: 1px&quot;>
<input type=&quot;button&quot;
name=&quot;d1&quot;
value=&quot;...&quot;
onClick=&quot;fPopCalendar(from_date,from_date);return false&quot;
class=&quot;CommonButton&quot;>
</td>
<td width=&quot;6%&quot;
class=&quot;ptd1&quot;
height=&quot;36&quot;>
<div align=&quot;center&quot;>至</div>
</td>
<td width=&quot;52%&quot;
class=&quot;ptd3&quot;
height=&quot;36&quot;>
<input type=&quot;text&quot;
name=&quot;to_date&quot;
size=&quot;15&quot;
style=&quot;border-color: #006600;
border-style:groove;
border-width: 1px&quot;>
<input type=&quot;button&quot;
name=&quot;d2&quot;
value=&quot;...&quot;
onClick=&quot;fPopCalendar(to_date,to_date);return false&quot;
class=&quot;CommonButton&quot;>
</td>
</tr>
</table>
<table width=&quot;100%&quot;
border=&quot;0&quot;
cellspacing=&quot;0&quot;
cellpadding=&quot;0&quot;>
<tr>
<td width=&quot;9%&quot;
class=&quot;ptd3&quot;
height=&quot;36&quot;>
<div align=&quot;center&quot;>经办人:</div>
</td>
<td width=&quot;18%&quot;
height=&quot;36&quot;
class=&quot;ptd2&quot;>
<select name=&quot;transcator&quot;>
<option value=&quot;&quot;>请选择经办人</option>
<%
set rsSofteng=server.CreateObject(&quot;adodb.recordset&quot;)
sqlSofteng=&quot;select Distinct I_Name from employee &quot;
rsSofteng.open sqlSofteng,conn,1,1
do while not rsSofteng.eof
%>
<option value=&quot;<%=Trim(rsSofteng(&quot;I_Name&quot;))%>&quot;><%=Trim(rsSofteng(&quot;I_Name&quot;))%></option>
<%
rsSofteng.movenext
loop
rsSofteng.close
set rsSofteng=nothing
%>
</select>
</td>
<td width=&quot;7%&quot;
class=&quot;ptd3&quot;>
<div align=&quot;center&quot;>供货商:</div>
</td>
<td width=&quot;24%&quot;
class=&quot;ptd3&quot;
height=&quot;38&quot;>
<select name=&quot;manufacture&quot;>
<option value=&quot;&quot;
selected>请选择供应商</option>
<%
set rsSofteng=server.CreateObject(&quot;adodb.recordset&quot;)
SqlSofteng=&quot;select Distinct M_Name from Manufacturer &quot;
rsSofteng.open sqlSofteng,conn,1,1
do while not rsSofteng.eof
%>
<option value=&quot;<%=rsSofteng(&quot;M_Name&quot;)%>&quot;><%=rsSofteng(&quot;M_Name&quot;)%></option>
<%
rsSofteng.movenext
loop
rsSofteng.close
set rsSofteng=nothing
%>
</select>
</td>
<td width=&quot;7%&quot;
class=&quot;ptd3&quot;>
<div align=&quot;center&quot;>接货员:</div>
</td>
<td width=&quot;35%&quot;
class=&quot;ptd4&quot;>
<select name=&quot;Accepter&quot;>
<option value=&quot;&quot;>请选择接货员</option>
<%
set rsSofteng=server.CreateObject(&quot;adodb.recordset&quot;)
sqlSofteng=&quot;select Distinct I_Name from employee &quot;
rsSofteng.open sqlSofteng,conn,1,1
do while not rsSofteng.eof
%>
<option value=&quot;<%=rsSofteng(&quot;I_Name&quot;)%>&quot;><%=rsSofteng(&quot;I_Name&quot;)%></option>
<%
rsSofteng.movenext
loop
rsSofteng.close
set rsSofteng=nothing
%>
</select>
 
<input type=&quot;submit&quot;
name=&quot;Submit&quot;
value=&quot;
&quot;
class=&quot;check&quot;>
<input type=&quot;button&quot;
name=&quot;Print&quot;
OnClick=&quot;javascript:print()&quot;
Class=&quot;print&quot;
value=&quot;
&quot;>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<table width=&quot;95%&quot;
border=&quot;0&quot;
cellspacing=&quot;1&quot;
cellpadding=&quot;0&quot;
bgcolor=&quot;A7B6C1&quot;
align=&quot;center&quot;>
<tr bgcolor=&quot;D7EAEA&quot;>
<td width=&quot;34%&quot;>
<div align=&quot;center&quot;>卷烟编号</div>
</td>
<td width=&quot;35%&quot;>
<div align=&quot;center&quot;>卷烟名称</div>
</td>
<td width=&quot;31%&quot;>
<div align=&quot;center&quot;>入库数量(万支)</div>
</td>
</tr>
<%'查询开始
dim rs
dim strsql
dim qfrom_date,qto_date '接收上一页传递的条件参数
dim qTranscator
dim qmanufacture
dim qAccepter

if request.QueryString(&quot;Type&quot;)<>&quot;&quot;
then
set rs=server.createobject(&quot;adodb.recordset&quot;)
strSql=&quot;Select I_Task_Detail.D_SmokeID,I_Task_Detail.SmokeName,SUM(I_Task_Detail.D_Smoke_Amount) AS Num &quot;
& _
&quot;From I_Task_Detail Inner Join I_Task On I_Task.T_ID=I_Task_Detail.D_ID Where I_Task.T_Complete=2 &quot;
if request.QueryString(&quot;Type&quot;)=&quot;1&quot; then
'直接查询
if trim(request.form(&quot;from_date&quot;))<>&quot;&quot;
then
qfrom_date = Trim(request.form(&quot;from_date&quot;)) '即将要进行下一页传递的参数
strSql=strSql & &quot;
And I_Task.T_Date >'&quot;
& trim(request.form(&quot;from_date&quot;)) & &quot;'&quot;
end if
if trim(request.form(&quot;to_date&quot;))<>&quot;&quot;
then
qto_date = Trim(request.form(&quot;to_date&quot;))
strSql=strSql & &quot;
And I_Task.T_Date <'&quot;
& trim(request.form(&quot;to_date&quot;)) & &quot;'&quot;
end if
if trim(request.form(&quot;Transcator&quot;))<>&quot;&quot;
then

qTranscator = Trim(request.form(&quot;Transcator&quot;))
strSql=strSql & &quot;
And I_Task.T_Transcator='&quot;
& trim(request.form(&quot;Transcator&quot;)) & &quot;'&quot;
end if
if trim(request.form(&quot;manufacture&quot;))<>&quot;&quot;
then

qmanufacture = Trim(request.form(&quot;manufacture&quot;))
strSql=strSql & &quot;
And I_Task.T_Manufacturer='&quot;
& trim(request.form(&quot;manufacture&quot;)) & &quot;'&quot;
end if
if trim(request.form(&quot;Accepter&quot;))<>&quot;&quot;
then

qAccepter = Trim(request.form(&quot;Accepter&quot;))
strSql=strSql & &quot;
And I_Task.T_Accepter='&quot;
& trim(request.form(&quot;Accepter&quot;)) & &quot;'&quot;
end if
page=1
else
'分页显示
if trim(request.QueryString(&quot;qfrom_date&quot;))<>&quot;&quot;
then
qfrom_date = Trim(request.QueryString(&quot;qfrom_date&quot;)) '即将要进行下一页传递的参数
strSql=strSql & &quot;
And I_Task.T_Date >'&quot;
& trim(request.QueryString(&quot;qfrom_date&quot;)) & &quot;'&quot;
end if
if trim(request.QueryString(&quot;qto_date&quot;))<>&quot;&quot;
then
qto_date = Trim(request.QueryString(&quot;qto_date&quot;))
strSql=strSql & &quot;
And I_Task.T_Date <'&quot;
& trim(request.QueryString(&quot;qto_date&quot;)) & &quot;'&quot;
end if
if trim(request.QueryString(&quot;qTranscator&quot;))<>&quot;&quot;
then

qTranscator = Trim(request.QueryString(&quot;qTranscator&quot;))
strSql=strSql & &quot;
And I_Task.T_Transcator='&quot;
& trim(request.QueryString(&quot;qTranscator&quot;)) & &quot;'&quot;
end if
if trim(request.QueryString(&quot;qmanufacture&quot;))<>&quot;&quot;
then

qmanufacture = Trim(request.QueryString(&quot;qmanufacture&quot;))
strSql=strSql & &quot;
And I_Task.T_Manufacturer='&quot;
& trim(request.QueryString(&quot;qmanufacture&quot;)) & &quot;'&quot;
end if
if trim(request.QueryString(&quot;qAccepter&quot;))<>&quot;&quot;
then

qAccepter = Trim(request.QueryString(&quot;qAccepter&quot;))
strSql=strSql & &quot;
And I_Task.T_Accepter='&quot;
& trim(request.QueryString(&quot;qAccepter&quot;)) & &quot;'&quot;
end if
if Request(&quot;Page&quot;)<>&quot;&quot;
then
Page = Cint(request.QueryString(&quot;Page&quot;))
else
Page =1
end if
end if
strSql=strSql & &quot;
GROUP BY I_Task_Detail.D_SmokeID, I_Task_Detail.SmokeName &quot;
strSql=StrSql & &quot;
Order By Num Desc &quot;
'显示SQL语句:response.write strSql
rs.open strSql,conn,1,1
if rs.recordCount <=0 then
response.write &quot;没有找到数据!&quot;
else
Total_RecordCount=rs.recordCount
rs.PageSize = Page_RecordCount
'判断页码
Page_Number=Int(Total_RecordCount / Page_RecordCount)
if (Total_RecordCount Mod Page_RecordCount) >0 then
Page_Number=Page_Number +1
else
Page_Number=Page_Number
end if
if Page >rs.PageCount then
'如果接收的页数大于总页数
rs.AbsolutePage =rs.PageCount '设置当前显示页等于最后页
else
if Page <= 0 then
'如果page小于等于0
Page = 1 '设置PAGE等于第一页
else
Rs.AbsolutePage = Page '如果大于零,显示当前页等于接收的页数
end if
For i = 1 to rs.PageSize
%>
<tr>
<td bgcolor=&quot;F8FEFD&quot;
width=&quot;34%&quot;>
<div align=&quot;center&quot;><%=trim(rs(&quot;D_SmokeID&quot;))%></div>
</td>
<td bgcolor=&quot;F8FEFD&quot;
width=&quot;35%&quot;>
<div align=&quot;center&quot;><%=trim(rs(&quot;SmokeName&quot;))%></div>
</td>
<td bgcolor=&quot;F8FEFD&quot;
width=&quot;31%&quot;>
<div align=&quot;center&quot;><%=trim(rs(&quot;Num&quot;))%></div>
</td>
</tr>
<%
Rs.MoveNext
if rs.EOF then
Exit For
Next
%>
</Table>
<%
if Cint(Page)>1 then
Response.Write &quot;<a Href=Input_anasis.asp?Type=2&qfrom_date=&quot;
& qfrom_date & &quot;&qto_date=&quot;
&qto_date& &quot;&qTranscator=&quot;
& qTranscator & &quot;&qmanufacture=&quot;
&qmanufacture& &quot;&qAccepter=&quot;
&qAccepter& &quot;&Page=1 Title=首页>首页</a>&quot;
Response.Write &quot;<a Href=Input_anasis.asp?Type=2&qfrom_date=&quot;
& qfrom_date & &quot;&qto_date=&quot;
&qto_date& &quot;&qTranscator=&quot;
& qTranscator & &quot;&qmanufacture=&quot;
&qmanufacture& &quot;&qAccepter=&quot;
&qAccepter& &quot;&Page=&quot;
& Cint(Page)-1 & &quot;>上一页</A>&quot;
end if

if Cint(Page)<rs.pagecount then

Response.Write &quot;<a Href=Input_anasis.asp?Type=2&qfrom_date=&quot;
& qfrom_date & &quot;&qto_date=&quot;
&qto_date& &quot;&qTranscator=&quot;
& qTranscator & &quot;&qmanufacture=&quot;
&qmanufacture& &quot;&qAccepter=&quot;
&qAccepter& &quot;&Page=&quot;
& cint(Page)+1 & &quot;>下一页</a>&quot;
Response.Write &quot;<a Href=Input_anasis.asp?Type=2&qfrom_date=&quot;
& qfrom_date & &quot;&qto_date=&quot;
&qto_date& &quot;&qTranscator=&quot;
& qTranscator & &quot;&qmanufacture=&quot;
&qmanufacture& &quot;&qAccepter=&quot;
&qAccepter& &quot;&Page=&quot;
& rs.PageCount & &quot;>尾页</a> &quot;
end if
End if
rs.Close
Set rs=nothing
end if
end if
%>
<a> <div align=&quot;center&quot;><font color=&quot;#990000&quot;>查询到数据记录共
<%Response.Write Total_RecordCount%>条,
共<%Response.Write Page_Number%>页!
当前是第<%Response.Write Page%>页!</font></div></a>
</body>
</html>
 
后退
顶部