ASP的问题,请诸位帮忙看看!(100分)

  • 主题发起人 主题发起人 mzyang
  • 开始时间 开始时间
M

mzyang

Unregistered / Unconfirmed
GUEST, unregistred user!
下面这段程序有什么错误?
我在点击完成按钮后,提示'对不起,该用户不存在或已被删除!'
难道执行完cek()函数后
sql2="select * from rck1 where job<>'""' and iname='"&amp;uid&amp;"'"
rs.open sql2,conn,1,1
的查询结果为空了?

<% Response.Buffer=True %>
<!--#include file="../inc/person.inc"-->
<!--#include file="../inc/html.inc"-->
<% uid=request("uid")
set rs=server.createobject("adodb.recordset")
sql2="select * from rck1 where job<>'""' and iname='"&amp;uid&amp;"'"
rs.open sql2,conn,1,1
if rs.eof or rs.bof then
response.write"<SCRIPT language=JavaScript>alert('对不起,该用户不存在或已被删除!');"
response.write"javascript:window.close();</SCRIPT>"
end if

uname=session("puid")
modify=request("modify")

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<link rel="stylesheet" href="../inc/register.css" type="text/css">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>测试青年人才库-添加信息</title>
</head>
<SCRIPT language=JavaScript src="../inc/validate.js"></SCRIPT>
<SCRIPT language=JavaScript src="../inc/vreg1.js"></SCRIPT>
<FORM name=modify1 action=modify1.asp method=post>
<body topmargin="0" leftmargin="0">
<!--#include file="../inc/top2.htm"-->

<table border="1" cellpadding="0" cellspacing="0" width="93%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" height="18" valign="bottom" bgcolor="#C6CEDE" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#FFFFFF">
<p align="center">&amp;nbsp;=== 个人基本资料 ===</td>
</tr>
<tr>
<td width="350" height="20" valign="bottom">
<p align="left">&amp;nbsp;录入员:<FONT COLOR="#FF0000"><%=uname%></FONT> &amp;nbsp;
</td>
</tr>
<tr>

<td width="350" height="20" valign="bottom" bgcolor="#F3F3F3">
&amp;nbsp;姓 名:<input type="text" name="iname" valign="bottom" size="12" maxLength=4 value="<%=rs("iname")%>">
</td>
</tr>
<tr>
<td width="350" height="28">
<p align="left">&amp;nbsp;性别:<input type="radio" <%if modify<>"true" or rs("sex") ="男" then
Response.Write "checked"%> value="男" name="sex">男
<input type="radio" <%if rs("sex") ="女" then
Response.Write "checked"%> name="sex" value="女">女
</p>
</td>
</tr>
<tr>
<td width="350" height="28" bgcolor="#F3F3F3">
<p align="left">&amp;nbsp;出生年月:<INPUT maxLength=10 size=10 name=bday maxLength=10 value="<%=rs("bday")%>">
</p>
</td>
</tr>
<tr>
<td width="350" height="28">
&amp;nbsp;身份证号码:<input type="text" name="code" size="18" maxLength=18 value="<%=rs("code")%>">
</td>
</tr>
<tr>
<td width="350" height="28" bgcolor="#F3F3F3">
<p align="left">&amp;nbsp;民族:<input type="text" name="mzhu" size="12" maxLength=12 value="<%=rs("mzhu")%>">
</p>
</td>
</tr>
<tr>
<td width="350" height="28">

<p align="left">&amp;nbsp;婚姻状况:<SELECT size=1 name=marry>
<OPTION value=未婚 <%if rs("marry") ="未婚" then
Response.Write "selected"%>>未婚
<OPTION value=已婚 <%if rs("marry") ="已婚" then
Response.Write "selected"%>>已婚
<OPTION value=离异 <%if rs("marry") ="离异" then
Response.Write "selected"%>>离异</OPTION></SELECT></p>
</td>
</tr>

<tr>
<td width="350" height="28" bgcolor="#F3F3F3">
<p align="left">&amp;nbsp;原籍:<input type="text" name="hka" size="12" maxLength=12 value="<%=rs("hka")%>">
</p>
</td>
</tr>


<tr>
<td width="350" height="28">
<p align="left">
&amp;nbsp;您的第一学历:<SELECT size=1
name=edu1> <OPTION>请在以下列表中选择</OPTION>
<OPTION value=初中 <%if rs("edu1") ="初中" then
Response.Write "selected"%>>初中
<OPTION value=高中 <%if rs("edu1") ="高中" then
Response.Write "selected"%>>高中
<OPTION value=中技 <%if rs("edu1") ="中技" then
Response.Write "selected"%>>中技
<OPTION value=中专 <%if rs("edu1") ="中专" then
Response.Write "selected"%>>中专
<OPTION value=大专 <%if rs("edu1") ="大专" then
Response.Write "selected"%>>大专
<OPTION value=本科 <%if rs("edu1") ="本科" then
Response.Write "selected"%>>本科
<OPTION value=硕士 <%if rs("edu1") ="硕士" then
Response.Write "selected"%>>硕士
<OPTION value=博士 <%if rs("edu1") ="博士" then
Response.Write "selected"%>>博士</OPTION></SELECT></p>
</td>
</tr>
<tr>
<td width="350" height="28" bgcolor="#F3F3F3">
<p align="left">
&amp;nbsp;专 业:<INPUT maxLength=60 size=30 name=zye1 maxLength=30 value="<%=rs("zye1")%>"></p>
</td>
</tr>
<tr>
<td width="350" height="28">
<p align="left">
&amp;nbsp;毕业院校:<INPUT maxLength=60 size=40 name=school1 maxLength=40 value="<%=rs("school1")%>"></p>
</td>
</tr>

<tr>
<td width="350" height="28">
<p align="left">
&amp;nbsp;您最高的教育程度:<SELECT size=1
name=edu2> <OPTION>请在以下列表中选择</OPTION>
<OPTION value=初中 <%if rs("edu2") ="初中" then
Response.Write "selected"%>>初中
<OPTION value=高中 <%if rs("edu2") ="高中" then
Response.Write "selected"%>>高中
<OPTION value=中技 <%if rs("edu2") ="中技" then
Response.Write "selected"%>>中技
<OPTION value=中专 <%if rs("edu2") ="中专" then
Response.Write "selected"%>>中专
<OPTION value=大专 <%if rs("edu2") ="大专" then
Response.Write "selected"%>>大专
<OPTION value=本科 <%if rs("edu2") ="本科" then
Response.Write "selected"%>>本科
<OPTION value=硕士 <%if rs("edu2") ="硕士" then
Response.Write "selected"%>>硕士
<OPTION value=博士 <%if rs("edu2") ="博士" then
Response.Write "selected"%>>博士</OPTION></SELECT></p>
</td>
</tr>
<tr>
<td width="350" height="28" bgcolor="#F3F3F3">
<p align="left">
&amp;nbsp;专 业:<INPUT maxLength=60 size=30 name=zye2 maxLength=30 value="<%=rs("zye2")%>"></p>
</td>
</tr>
<tr>
<td width="350" height="28">
<p align="left">
&amp;nbsp;毕业院校:<INPUT maxLength=60 size=40 name=school2 maxLength=40 value="<%=rs("school2")%>"></p>
</td>
</tr>





<tr>
<td width="350" height="28" bgcolor="#F3F3F3">
<p align="left">
&amp;nbsp;政治面貌:<SELECT size=1 name=zzmm> <OPTION>请在以下列表中选择</OPTION>
<OPTION value=党员 <%if rs("zzmm") ="党员" then
Response.Write "selected"%>>党员
<OPTION value=团员 <%if rs("zzmm") ="团员" then
Response.Write "selected"%>>团员
<OPTION value=群众 <%if rs("zzmm") ="群众" then
Response.Write "selected"%>>群众
<OPTION value=民主党派 <%if rs("zzmm") ="民主党派" then
Response.Write "selected"%>>民主党派
<OPTION value=其它 <%if rs("zzmm") ="其它" then
Response.Write "selected"%>>其它</OPTION></SELECT></p>
</td>
</tr>
<tr>
<td width="350" height="28">
<p align="left">
&amp;nbsp;现有职称:<SELECT size=1 name=zchen> <OPTION>请在以下列表中选择</OPTION>
<OPTION value=高级 <%if rs("zchen") ="高级" then
Response.Write "selected"%>>高级
<OPTION value=中级 <%if rs("zchen") ="中级" then
Response.Write "selected"%>>中级
<OPTION value=初级 <%if rs("zchen") ="初级" then
Response.Write "selected"%>>初级
<OPTION value=暂无 <%if rs("zchen") ="暂无" then
Response.Write "selected"%>>暂无
<OPTION value=其它 <%if rs("zchen") ="其它" then
Response.Write "selected"%>>其它</OPTION></SELECT></p>
</td>
</tr>
<tr>
<td valign="top" width="350">

</td>
</tr>
</table>
</td>

<table border="1" cellpadding="0" cellspacing="0" width="93%" height="258" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" height="18" valign="bottom" bgcolor="#C6CEDE" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#FFFFFF">
<p align="center">=== 个人主要特长 ===</td>
</tr>
<tr>
<td width="100%" height="124" valign="top" bgcolor="#F3F3F3">
<p align="left">
<br>
外语特长:<SELECT
size=1 name=language> <OPTION value=无 <%if rs("language") ="无" then
Response.Write "selected"%>>无
<OPTION value=英语 <%if rs("language") ="英语" then
Response.Write "selected"%>>英语
<OPTION value=日语 <%if rs("language") ="日语" then
Response.Write "selected"%>>日语
<OPTION value=法语 <%if rs("language") ="法语" then
Response.Write "selected"%>>法语
<OPTION value=德语 <%if rs("language") ="德语" then
Response.Write "selected"%>>德语
<OPTION value=俄语 <%if rs("language") ="俄语" then
Response.Write "selected"%>>俄语
<OPTION value=朝鲜语 <%if rs("language") ="朝鲜语" then
Response.Write "selected"%>>朝鲜语
<OPTION value=西班牙语 <%if rs("language") ="西班牙语" then
Response.Write "selected"%>>西班牙语
<OPTION value=阿拉伯语 <%if rs("language") ="阿拉伯语" then
Response.Write "selected"%>>阿拉伯语
<OPTION value=其它 <%if rs("language") ="其它" then
Response.Write "selected"%>>其它</OPTION></SELECT>&amp;nbsp;
<SELECT size=1 name=lanlevel>
<OPTION value=无 <%if rs("lanlevel") ="无" then
Response.Write "selected"%>>无
<OPTION value=四级 <%if rs("lanlevel") ="四级" then
Response.Write "selected"%>>四级
<OPTION value=八级 <%if rs("lanlevel") ="八级" then
Response.Write "selected"%>>八级
<OPTION value=六级 <%if rs("lanlevel") ="六级" then
Response.Write "selected"%>>六级
<OPTION value=熟练 <%if rs("lanlevel") ="熟练" then
Response.Write "selected"%>>熟练
<OPTION value=精通 <%if rs("lanlevel") ="精通" then
Response.Write "selected"%>>精通
<OPTION value=良好 <%if rs("lanlevel") ="良好" then
Response.Write "selected"%>>良好
<OPTION value=一般 <%if rs("lanlevel") ="一般" then
Response.Write "selected"%>>一般</OPTION></SELECT></p>
&amp;nbsp;
计算机能力:
<SELECT size=1 name=computer>
<OPTION value=一般 <%if rs("computer") ="一般" then
Response.Write "selected"%>>一般
<OPTION value=优秀 <%if rs("computer") ="优秀" then
Response.Write "selected"%>>优秀
<OPTION value=良好 <%if rs("computer") ="良好" then
Response.Write "selected"%>>良好
<OPTION value=较差 <%if rs("computer") ="较差" then
Response.Write "selected"%>>较差</OPTION></SELECT></p>

<p align="left">
&amp;nbsp;专业特长:<INPUT maxLength=60 size=40 name=zyetc maxLength=40 value="<%=rs("zyetc")%>"></p>

<p align="left">其他主要特长:<br>
<font color="#FF0000">
(限100字以内)</font><br>
<%kothertc=replace(rs("othertc"),"<br>",chr(13))
kothertc=replace(kothertc,"&amp;nbsp;"," ")%>
<textarea rows="6" name="othertc" cols="34"><%=kothertc%></textarea>
<br>
<br>

</td>
</tr>
<tr>
<td width="100%" height="18" valign="bottom" bgcolor="#C6CEDE" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#FFFFFF">
<p align="center">=== 相关工作经历 ===
</td>
</tr>
<tr>
<td width="100%" height="108" valign="top" bgcolor="#F3F3F3">
<p align="left"><br>
工作经验:至今相关工作经验共有<INPUT maxLength=2 size=2 name=gznum value="<%=rs("gznum")%>">年</p>
<p align="left">详细工作经历:<BR>按照格式<font color="#FF0000">{始(年.月) 至(年.月) 职务名称 公司名称}</font>填写
<%
kgzjl=replace(rs("gzjl"),"<br>",chr(13))
kgzjl=replace(kgzjl,"&amp;nbsp;"," ")%>
</p>
<textarea rows="11" name="gzjl" cols="48"><%=kgzjl%></textarea>
<br>
<br>

<p align="left">
&amp;nbsp;职 务:<INPUT maxLength=60 size=40 name=jobtype maxLength=40 value="<%=rs("jobtype")%>"></p>
<p align="left">
&amp;nbsp;工 作:<INPUT maxLength=60 size=40 name=job maxLength=40 value="<%=rs("job")%>"></p>
<p align="left">
&amp;nbsp;工作单位:<INPUT maxLength=60 size=40 name=gzdd maxLength=40 value="<%=rs("gzdd")%>"></p>
<p align="left">
&amp;nbsp;联系人:<INPUT maxLength=60 size=40 name=cname maxLength=40 value="<%=rs("cname")%>"></p>
<p align="left">
&amp;nbsp;联系电话:<INPUT maxLength=60 size=40 name=phone maxLength=40 value="<%=rs("phone")%>"></p>
<p align="left">
&amp;nbsp;传呼号码:<INPUT maxLength=60 size=40 name=callnum maxLength=40 value="<%=rs("callnum")%>"></p>
<p align="left">
&amp;nbsp;联系地址:<INPUT maxLength=60 size=40 name=address maxLength=40 value="<%=rs("address")%>"></p>


<p align="center">

<input type="button" value="完成" onClick="cek();"><br><br>
<br>
<br>
</td>
</tr>
</table>
<% rs.close %>
</div>
</form>
</body>
</html>
<center>
<td width="1" height="243" valign="top" bgcolor="#00006A"></td>
<td width="138" height="243" valign="top" bgcolor="#F3F3F3"> </td>
</tr>
<tr>
<td width="778" height="1" valign="top" colspan="5" bgcolor="#396BA5">
<p align="center">
</td>
</tr>
<tr>
<td width="778" height="4" valign="top" colspan="5">
<p align="center">
</td>
</tr>
<tr>
<td width="778" height="4" valign="top" colspan="5">
<p align="center"><script language="javascript" src="../inc/copyright.js"></script>
</td>
</tr>
<tr>
<td width="778" height="4" valign="top" colspan="5">
</td>
</tr>
</table>
</center>
</div>
</form>
</body>
</html>

<%
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from rck1 where iname='"&amp;uid&amp;"'"
rs.open sql,conn,3,3

iname=request("iname")
if iname="" then
iname=rs("iname") end if
sex=request("sex")
bday=request("bday")
if bday="" then
Response.End
code=request("code")
mzhu=request("mzhu")
marry=request("marry")
hka=request("hka")
zzmm=request("zzmm")
zchen=request("zchen")
zye1=request("zye1")
edu1=request("edu1")
school1=request("school1")
zye2=request("zye2")
edu2=request("edu2")
school2=request("school2")
language=request("language")
lanlevel=request("lanlevel")
computer=request("computer")
zyetc=request("zyetc")
othertc=htmlencode2(request("othertc"))
if othertc="" then
othertc="无其他特长" end if
gznum=request("gznum")
gzjl=htmlencode2(request("gzjl"))
if gzjl="" then
Response.End
jobtype=request("jobtype")
job=request("job")
gzdd=request("gzdd")
cname=request("cname")
if cname="" then
Response.End
phone=request("phone")
callnum=request("callnum")
address=request("address")
if callnum="" then
callnum="未知" end if
rs.close
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from rck1 where iname='"&amp;uid&amp;"'"
rs.open sql,conn,3,3
rs("uname")=uname
rs("iname")=iname
rs("sex")=sex
rs("bday")=bday
rs("code")=code
rs("mzhu")=mzhu
rs("marry")=marry
rs("hka")=hka
rs("zzmm")=zzmm
rs("zchen")=zchen
rs("zye1")=zye1
rs("edu1")=edu1
rs("school1")=school1
rs("zye2")=zye2
rs("edu2")=edu2
rs("school2")=school2
rs("language")=language
rs("lanlevel")=lanlevel
rs("computer")=computer
rs("zyetc")=zyetc
rs("othertc")=othertc
rs("gznum")=gznum
rs("gzjl")=gzjl
rs("jobtype")=jobtype
rs("job")=job
rs("gzdd")=gzdd
rs("cname")=cname
rs("phone")=phone
rs("callnum")=callnum
rs("address")=address
rs("idate")=date()
rs.update
rs.close
response.write"<SCRIPT language=JavaScript>alert('已经修改完毕!');"
response.write"javascript:window.close();</SCRIPT>"
%>

function checkmod()
{
if (isInvalidDate(register.bday.value,"-")==true){
alert("请正确填写您的出生日期(例如:1981-11-12)!");
register.bday.focus();
return (false);
}
if (isNaN(register.code.value)){
alert("身份证号码只能填数字!");
register.code.focus();
return (false);
}
if (checkstring("身份证号码",do
cument.register.code.value, false)) {
do
cument.register.code.focus();
return false;

}
if ((register.code.value.length!=15) &amp;&amp;
(register.code.value.length!=18 )) {
alert("请正确填写您的身份证号码!");
register.code.focus();
return (false);
}
if (checkstring("民族",do
cument.register.mzhu.value, false)) {
do
cument.register.mzhu.focus();
return false;

}
if (register.hka.value=="") {
alert("请选择您的户籍所在地!");
register.hka.focus();
return (false);
}
if (register.edu1.value=="") {
alert("请选择您的最高教育程度!");
register.edu1.focus();
return (false);
}
if (checkstring("专业",do
cument.register.zye1.value, false)) {
do
cument.register.zye1.focus();
return false;

}
if (checkstring("毕业院校",do
cument.register.school1.value, false)) {
do
cument.register.school1.focus();
return false;

}
if (register.zzmm.value=="") {
alert("请选择您的政治面貌!");
register.zzmm.focus();
return (false);
}
if (register.zchen.value=="") {
alert("请选择您的现有职称!");
register.zchen.focus();
return (false);
}
else
do
cument.register.submit();
}
function check()
{
if (checkstring("真实姓名",do
cument.register.iname.value, false)) {
do
cument.register.iname.focus();
return false;

}
checkmod()
}


function cekmod()
{
if (isInvalidDate(modify1.bday.value,"-")==true){
alert("请正确填写您的出生日期(例如:1981-11-12)!");
modify1.bday.focus();
return (false);
}
if (isNaN(modify1.code.value)){
alert("身份证号码只能填数字!");
modify1.code.focus();
return (false);
}
if (checkstring("身份证号码",do
cument.modify1.code.value, false)) {
do
cument.modify1.code.focus();
return false;

}
if ((modify1.code.value.length!=15) &amp;&amp;
(modify1.code.value.length!=18 )) {
alert("请正确填写您的身份证号码!");
modify1.code.focus();
return (false);
}
if (checkstring("民族",do
cument.modify1.mzhu.value, false)) {
do
cument.modify1.mzhu.focus();
return false;

}
if (modify1.hka.value=="") {
alert("请选择您的户籍所在地!");
modify1.hka.focus();
return (false);
}
if (modify1.edu1.value=="") {
alert("请选择您的最高教育程度!");
modify1.edu.focus();
return (false);
}
if (checkstring("专业",do
cument.modify1.zye1.value, false)) {
do
cument.modify1.zye.focus();
return false;

}
if (checkstring("毕业院校",do
cument.modify1.school1.value, false)) {
do
cument.modify1.school.focus();
return false;

}
if (modify1.zzmm.value=="") {
alert("请选择您的政治面貌!");
modify1.zzmm.focus();
return (false);
}
if (modify1.zchen.value=="") {
alert("请选择您的现有职称!");
modify1.zchen.focus();
return (false);
}
else
do
cument.modify1.submit();
}
function cek()
{
if (checkstring("真实姓名",do
cument.modify1.iname.value, false)) {
do
cument.modify1.iname.focus();
return false;

}
cekmod()
}




 
if rs.eof or rs.bof
改为
if rs.eof and rs.bof
估计就ok了,建议你以后别都粘贴这么多代码
-----
http://www.8421.org
 
to qdyoung:
您的答案试验后不正确!希望你能多帮我分析一下!
 
sql2="select * from rck1 where job<>'""' and iname='"&amp;uid&amp;"'"
rs.open sql2,conn,1,1
---------------------
第一确保你的SQL语句正确, 可以在网页上打印出来,在SQL expore上试一试
第二尝试改为 将 rs.open sql2,conn,1,1
set rs = DBConn.Execute(StrSql)
 
if rs.recordcount=0 then
response.write"<SCRIPT language=JavaScript>alert('对不起,该用户不存在或已被删除!');"
response.write"javascript:window.close();</SCRIPT>"
end if
 
你的SQL语句可能有点问题:
sql2="select * from rck1 where job<>'""' and iname='"&amp;uid&amp;"'"
~~~~~~~~~
划了下划线的地方恐怕有问题
如果要判断job字段不为空的话:
sql2="select * from rck1 where job<>'' and iname='"&amp;uid&amp;"'"
 
to all :
这段程序内容实际上是想对iname='"&amp;uid&amp;"'"的记录进行修改,之后存储。
数据查询没有问题,当该页打开时查询结果可以正常显示,对部分字段内容修改后
,点击“完成”按钮时,出现我最初说的问题。
为什么网页打开时,数据查询结果正确,但执行完cek()函数后,又不正确了呢,
查询结果为空?。
另外在cek()函数中,实际执行的最后一句为document.modify1.submit(),它的作用
和效果是什么?引起了POST事件?重新执行页内的JS部分程序?
问题是否再次?
 
  真是太长了。:)
 
你的代码太长了,我没调试过,不过我看这句代码好像不对啊
sql2="select * from rck1 where job<>'""' and iname='"&amp;uid&amp;"'"
平常我是这么写的!
sql2="select * from rck1 where job<>'' and iname='" &amp;
uid &amp;'"
 
楼上说的有道理
 
试试这个:sql2="select * from rck1 where job not Is Null and iname='"&amp;uid&amp;"'"
~~~~~~~~~~~~~~
 
问题已经解决,刚写大家参与,问题出在action=modify1.asp 一句,删除后一切正常
 

Similar threads

I
回复
0
查看
883
import
I
I
回复
0
查看
627
import
I
I
回复
0
查看
784
import
I
I
回复
0
查看
642
import
I
I
回复
0
查看
526
import
I
后退
顶部