ASP查询Access数据库报错 急!!!该怎样做才对呀?

Ai2015WER 2011-11-01 09:40:03

<!--#include file="include/conn1.asp"-->
<!--#include file="include/conn_znx.asp"-->

<style type="text/css">
.div_li{
float:left; height:160px; border:1px solid #cfdae8; width:410px; margin-left:-1px; margin-top:-1px;
/*list-style : none;url(example.gif) square inside;*/
}
ul { margin-left:1px; margin-top:1px; width:505px; }
li{list-style-type:none;}

</style>

<%
'response.write(session("username"))
dim zxzffs
dim zxzfje

zxzffs=request("zffs")
zxzfje=request("je")

dim rs
dim gsjs

dim zhwh

dim zxdtmc(5)
dim zxdtid(5)
dim i

dim hyalmc(6)
dim hyalid(6)

dim ozzhmc(6)
dim ozzhid(6)

dim jdwdmc(6)
dim jdwdid(6)

' 测试使用
dim jprrs '会员实体数据信息
dim jpruserbean '用户实体
dim jpruserid '会员ID
dim jprusername '会员姓名
dim jprage '会员年龄
dim jprhigh '会员身高
dim jprweight '会员体重
dim jprtel '会员电话
dim jprdesc '会员自我描述
dim jpr_men(30) '所有男性信息
dim jpr_women(30) '所有女性信息

dim myhzp
dim wyhzp

dim sql_m '顶部照片男
dim sql_w '顶部照片女

dim rs_m
dim rs_w

dim wzzwmc '网站名称

dim cgltp '成功率照片

'成功率图片
sql="select CGTP from FH_CGTP"
set rs=conn.execute(sql)

if Err.number<>0 then
response.write(wrong)
end if

do while not rs.eof
cgltp=rs("CGTP")
rs.movenext
if rs.eof then exit do
loop

rs.close
set rs=nothing


'网站名称
sql="select ZWMC from FH_WZMC"
set rs=conn.execute(sql)

if Err.number<>0 then
response.write(wrong)
end if

do while not rs.eof
wzzwmc=rs("ZWMC")
rs.movenext
if rs.eof then exit do
loop

rs.close
set rs=nothing


'顶部照片男
sql_m="select top 30 ZPDZ from FH_HYZP_SH where XB='0' and SYTP='1' and ZPDZ<>null"
set rs_m=conn_znx.execute(sql_m)


if Err.number<>0 then
response.write(wrong)
end if

'顶部照片女
'sql_w="select top 30 ZPDZ from FH_HYZP_SH where XB='1' and SYTP='1' and ZPDZ<>null"
sql_w="select top 30 * from FH_HYZP_SH where XB='1' and SYTP='1' and ZPDZ<>null"
set rs_w=conn_znx.execute(sql_w)
if Err.number<>0 then
response.write(wrong)
end if

'女性个人信息
do while not rs_w.eof
if i= 30 then
exit do
end if
sql="select * from FH_HYZC " 'where YHID='122"
set jprrs=conn.execute(sql)
for j=0 to 1
if(j=1) then
exit do
end if
jpr_men(i)=jprrs
if Err.number<>0 then
response.write(wrong)
end if
next

i=i+1
rs_w.movenext
if rs_w.eof then exit do
loop

dim zwnc



%>
<!--<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">-->
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<HTML>
<HEAD>
<TITLE><%=wzzwmc%>首页</TITLE>
</HEAD>
<script language="javascript" src="include/md5.js"></script>



<BODY leftmargin=0 topmargin=0>
<center>
<form name="main" action="" method="post">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD background="image/layout-sy-img-1-1.png" WIDTH="1004" HEIGHT="208">
<embed src="swf/banner.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="1004" wmode="transparent" height="100%">
</embed>
</TD>
</TR>
<TR>
<TD WIDTH="1004" HEIGHT="868">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="1004" HEIGHT="868">
<TR>
<TD background="image/layout-sy-img-1-1-1.png" WIDTH="1004" HEIGHT="10"></TD>
</TR>
<TR>
<TD WIDTH="1004" HEIGHT="256">
<table BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="1004" HEIGHT="256">
<tr>
<td width=40>
</td>
<td width=924 height=156>
<marquee width=924 height=146 align=mmiddle direction="right" behavior=alternate loop=-1 scrollamount=3 scrolldelay=3 hspace=8 vspace=5 onMouseOver="this.stop()" onMouseOut="this.start()">
<%
do while not rs_w.eof
wyhzp=rs_w("ZPDZ")
jpruserid=rs_w("YHID")
response.write("hello")
jprsql="select NM from FH_HYZC where YHID='" & jpruserid
set jpruserbean=conn.execute(jprsql)
if Err.number<>0 then
response.write(wrong)
end if
jprusername = jpruserbean("NM")
%>
<img src="<%=wyhzp%>" alt="<%=jprusername%>" width=130 height=140>
<%
rs_w.movenext

if rs_w.eof then exit do

loop
rs_w.close
set rs_w=nothing
%>
</marquee>

<%
do while not jprrs.eof
%>
<b>我的姓名:<%=jprrs("NM")%>,母语:<%=jprrs("MY")%>,体重:<%=jprrs("TZ")%>Kg,身高<%=jprrs("SG")%>cm.简要描述:<%=jprrs("GXSM")%></b><br/>
我的联系方式:手机(<%=jprrs("SJHM")%>),座机(<%=jprrs("DHHM")%>),Email(<%=jprrs("YHMSN")%>|<%=jprrs("MSN")%>)<br/>
<%
jprrs.movenext

if jprrs.eof then exit do

loop
jprrs.close
set jprrs=nothing
%>
</td>
<td width=40>
</td>
</tr>
</table>
<!--Test Start-->
<div style="width:924;height:100px;border:1px solid red;margin-left:40px;" >
<%
for i=1 to 10
%>
<li class="div_li"><%=i&" love "&(i+1) %><li>
<%
next
%>
</div>
<!--Test End-->
</TD>
</TR>
。。。。。。。
</center>
</BODY>
</HTML>
<!--#include file="include/disconn_znx.asp"-->
<!--#include file="include/disconn.asp"-->



其中'女性个人信息处(顶部)
sql="select * from FH_HYZC where YHID=" & rs_w("YHID")
set jprrs=conn.execute(sql) '报错信息是乱码,看不出来,其他代码行都没问题
这段代码报错,是哪里错了呀,我就查询一行记录出来,求解!!!!
...全文
88 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
黑心 2011-11-01
  • 打赏
  • 举报
回复
ID []
Ai2015WER 2011-11-01
  • 打赏
  • 举报
回复
多谢,我已经查出来了。不是其他问题,是我的字段名称写错了。应该是
sql="select * from FH_HYZC where [ID]="&rs_w("YHID")
结贴了,谢谢
叫我梁大侠 2011-11-01
  • 打赏
  • 举报
回复
sql="select * from FH_HYZC where YHID=" & rs_w("YHID")

里面的YHID是什么类型的字段啊

如果是数字型的
sql="select * from FH_HYZC where YHID="&rs_w("YHID")&""
如果是字符型的
sql="select * from FH_HYZC where YHID='"&rs_w("YHID")&"'"

试试

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧