| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 512 人关注过本帖
标题:[求助]一个奇怪的现象
只看楼主 加入收藏
zfjian
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2006-7-20
收藏
 问题点数:0 回复次数:2 
[求助]一个奇怪的现象

我碰到一个奇怪的现象,在用主键(自动编号)作为数据库查询条件时,结果不能显示任何数据。但是用其他条件查询数据库时却能显示数据。具体代码如下,请大家帮忙解释一下怎么会出现这种情况?主要的地方我都用红色标出来了!
<!--#include file="../conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.unnamed1 {
font-size: 9pt;
}
-->
</style>
</head>
<SCRIPT>
<!--
function openwindow(url) {
window.open(url,'new','toolbar=no,scrollbars=yes,width=200,height=120');
}
//-->
</SCRIPT>
<body background="../images/admin/back.gif">
<div align="center">

<table width="102%" border="0" align="center" cellspacing="1" bgcolor="#F2F5FD" class="unnamed1">
<tr>
<td width="100%" height="28" class="unnamed1">
<p align="center"><font color="#000000" style="font-size: 14px"><strong>
会 员 处 理 </strong></font>
</td>
</tr>


<tr>
<td width="100%" class="unnamed1"><br>
<%
Const MaxPerPage=10
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
set rs=server.CreateObject("adodb.recordset")
sql="select * from daili_tx where txkey=0 "
rs.open sql,conn,1,1

a=1
if err.number<>0 then
response.write "数据库中无数据"
end if

if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 暂没信息!</p>"
else
totalPut=rs.recordcount

if currentpage<1 then
currentpage=1
end if

if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if

if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"dl_zhengshi.asp" '当前页面地址
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"dl_zhengshi.asp" '当前页面地址
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"dl_zhengshi.asp" '当前页面地址
end if
end if
end if

sub showContent
dim i,j
i=0

%>
<div align="center"><center>
<table border="1" cellspacing="0" width="100%" style="border-collapse: collapse" bordercolor="#183789" cellpadding="0">
<tr class="unnamed1">
<td width="5%" align="center" height="28"> <strong><font color="#BB0000">ID</font></strong></td>
<td width="9%" align="center"><font color="#BB0000"><strong>用户名</strong></font></td>
<td width="9%" align="center" height="28"><font color="#BB0000"><strong>姓名</strong></font> </td>
<td width="21%" align="center" height="28">
<div align="center"><font color="#BB0000"><strong>处理地址</strong></font></div>
</td>
<td width="17%" align="center" height="28">
<div align="center"><b><font color="#BB0000">处理号码</font></b></div>
</td>
<td width="10%" align="center" height="28">
<div align="center"><font color="#BB0000"><b>处理类型</b></font></div>
</td>
<td width="19%" align="center" height="28">
<div align="center"><b><font color="#BB0000">处理时间</font></b></div>
</td>
<td width="10%" align="center" height="28"><b> <font color="#BB0000">操作</font></b></td>
</tr>
<% do while not rs.eof%>
<tr class="unnamed1">
<td height="23" style="border-bottom: 1px "><p align="center"><%=rs("txid")%>
</td>
<td height="23" style="border-bottom: 1px "><div align="center"><%=rs("txuser")%></div></td>
<td style="border-bottom: 1px "><p align="center"><%=rs("txname")%> </td>
<td align="center" style="border-bottom: 1px "><div align="center"><%=rs("txbak")%></div>
</td>
<td align="center" style="border-bottom: 1px "><div align="center"><%=rs("txcard")%></div>
</td>
<td align="center" style="border-bottom: 1px "><div align="center"><%=rs("txnum")%></div>
</td>
<td align="center" style="border-bottom: 1px "><div align="center"><%=rs("txtime")%></div>
</td>
<td align="center" style="border-bottom: 1px "><a href="untitled1.asp?txid=<%=rs("txid")%>" target="_self">同意处理</a></td>
</tr>
<%
rs.movenext
i=i+1
j=j+1
if i>=MaxPerPage then Exit Do
loop
rs.close
set rs=nothing
%>
</table>
</center></div><%
End Sub
Function showpage(totalnumber,maxperpage,filename)
Dim n

If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If

Response.Write "<form method=Post action="&filename&">"
Response.Write "<p align='center' class='contents'> "
If CurrentPage<2 Then
Response.Write "<font class='contents'>首页 上一页</font> "
Else
Response.Write "<a href="&filename&"?page=1 class='contents'>首页</a> "
Response.Write "<a href="&filename&"?page="&CurrentPage-1&" class='contents'>上一页</a> "
End If

If n-currentpage<1 Then
Response.Write "<font class='contents'>下一页 尾页</font>"
Else
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&" class='contents'>"
Response.Write "下一页</a> <a href="&filename&"?page="&n&" class='contents'>尾页</a>"
End If
Response.Write "<font class='contents'> 页次:</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "
Response.Write "<font class='contents'> 共有"&totalnumber&"个信息 "
Response.Write "<font class='contents'>转到:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="&currentpage&">"
Response.Write "&nbsp;<input type='submit' class='button' value='GO' name='cndok'></form>"
End Function
%>
<p> </td>
</tr>
</table>
</div>
</body>
</html>


untitled1.asp页面的代码
<!--#include file="../conn.asp"-->

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<%
set rs=Server.Createobject("ADODB.RecordSet")
sql = "select * from daili_tx where txid='"&request("txid")&"'" ’用txid(自动编号)作为查询条件时无法显示数据,用其他条件比如txuser却可以。请各位帮忙解释一下,这到底是怎么回事?
rs.Open sql,conn,1,3
%>
<%=rs("txuser")%>
</body>
</html>


[此贴子已经被作者于2006-12-15 22:49:07编辑过]

搜索更多相关主题的帖子: html 数据库查询 content include color 
2006-12-15 22:45
rainic
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2367
专家分:0
注 册:2005-8-9
收藏
得分:0 
txid='"&request("txid")&"'"
改成
txid="&request("txid")

2006-12-15 22:49
zfjian
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2006-7-20
收藏
得分:0 
谢谢rainic为我解惑!!!!
2006-12-16 15:15
快速回复:[求助]一个奇怪的现象
数据加载中...
 
   



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

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