| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 560 人关注过本帖
标题:一个新手问题,会的帮个忙,谢谢。
只看楼主 加入收藏
fnartly
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-7-21
收藏
 问题点数:0 回复次数:9 
一个新手问题,会的帮个忙,谢谢。

<!--#include file="opendb.asp"-->
<%
on error resume next
set rst=server.createobject("adodb.recordset")
id=request.querystring("id")
if request.querystring("act")="modify" then
conn.begintrans
rst.open "select * from user where u_id="&id, conn, 1, 3
rst("u_user")=request.form("f_user")
rst("u_code")=request.form("f_code")
rst.update
rst.close
rst.open "select * from info where i_uid="&id, conn, 1, 3
rst("i_name")=request.form("f_name")
rst("i_sex")=request.form("f_sex")
rst("i_age")=request.form("f_age")
if request.form("f_vip")=1 then
rst("i_vip")=true
else
rst("i_vip")=false
end if
rst.update
rst.close
if err.number>0 then
response.write("更新失败")
conn.rollbacktrans
else
response.write("更新成功")
conn.committrans
end if
end if
%>
<table width="779" height="744" border="0" cellspacing="1" background="img/hyzlxg.jpg">
<tr>
<td width="52" height="126">&nbsp;</td>
<td width="682">&nbsp;</td>
<td width="35">&nbsp;</td>
</tr>
<tr>
<td height="550">&nbsp;</td>
<td align="center" valign="middle">
<%rst.open "select * from user,info where u_id="&id&" and i_uid="&id, conn, 1, 1%>
<form name="fomr1" method="post" action="modify.asp?act=modify&id=<%=request.querystring("id")%>">
<table width="574" height="318" border="0" cellpadding="5" cellspacing="1">

<tr>
<td colspan="2" align="center">请在下面表中填写你的资料</td>
</tr>
<tr>
<td width="117" align="right">用户名:</td>
<td width="434" align="left"><input type="text" name="f_user" id="f_user" value="<%=rst("u_user")%>" /></td>
</tr>
<tr>
<td align="right">密 码: </td>
<td align="left"><input type="password" name="f_code" id="f_code" value="<%=rst("u_code")%>" /></td>
</tr>
<tr>
<td align="right">姓 名:</td>
<td align="left"><input type="text" name="f_name" id="f_name" value="<%=rst("i_name")%>" /></td>
</tr>
<tr>
<td align="right">年 龄:</td>
<td align="left"><input type="text" name="f_age" id="f_age" value="<%=rst("i_age")%>" /></td>
</tr>
<tr>
<td height="37" align="right">性 别:</td>
<td align="left"><input type="text" name="f_set" value="<%=rst("i_sex")%>" /></td>
</tr>
<tr>
<td align="right">VIP:</td>
<td align="left"> <input type="radio" name="f_vip" value="1" <% if rst("i_vip") then
response.write "checked" end if%> />是
&nbsp;&nbsp;&nbsp;<input type="radio" name="f_vip" value="0" <% if not rst("i_vip") then
response.write "checked" end if%>/>否
</td>
</tr>
<tr>
<td colspan="2" align="center" valign="middle"><input type="submit" name="sub" value="修改">&nbsp;&nbsp;&nbsp;<input type="reset" name="res" value="重置"/></td>
</tr>
</table></form> </td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<%rst.close
set rst=nothing
conn.close
set rst=nothing
%>

错误类型:
Microsoft VBScript 编译器错误 (0x800A0412)
必须是行中的第一个语句
/zy/modify.asp, line 81, column 25
response.write "checked" end if

到底错哪了,找了半天找不出来。81行就是加红字那一行。

搜索更多相关主题的帖子: include modify 
2007-08-02 22:42
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
<td align="right">VIP:</td>
<td align="left"> <input type="radio" name="f_vip" value="1" <% if rst("i_vip") then
response.write "checked" end if%> />是
&nbsp;&nbsp;&nbsp;<input type="radio" name="f_vip" value="0" <% if not rst("i_vip") then
response.write "checked" end if%>/>否
</td>
试试改成这样
<td align="right">VIP:</td>
<td align="left"> <input type="radio" name="f_vip" value="<%=rst("i_vipt")%>"
<% if rst("i_vip")=1 then
response.write "checked" end if%> />是
&nbsp;&nbsp;&nbsp;
<input type="radio" name="f_vip" value="<%=rst("i_vip")%>"
<% if rst("i_vip")=0 then
response.write "checked" end if%>/>否
2007-08-03 01:32
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
<td align="right">VIP:</td>
<td align="left">
<input type="radio" name="f_vip" value="1" <%if rst("i_vip") then response.write "checked"%>/>是
&nbsp;&nbsp;&nbsp;
<input type="radio" name="f_vip" value="0" <%if not rst("i_vip") then response.write "checked"%>/>否
</td>


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-08-03 08:28
fnartly
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-7-21
收藏
得分:0 

阳光版主,我把两个end if去掉以后,就变成这个错误了:
Microsoft VBScript 编译器错误 (0x800A03F6)
缺少 'End'
/zy/modify.asp, 第 101 行
101行是最后一行,为什么不要end if呢?能不能给解释一下原因,本人刚学,还在看初级教材,十分感谢。

2007-08-03 09:23
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
<%if rst("i_vip") then response.write "checked"%>

这个要写在一行

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-08-03 09:25
fnartly
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-7-21
收藏
得分:0 

Yeah,现在可以了,居然这样的语句不能分行,难怪昨天我看痛了眼睛也不知道错在哪里,
这是什么样的规定呢?为什么其它语句里if then 分行都可以,这里就不行?

2007-08-03 09:53
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 

[QUOTE]有关 if 语法有几种格式:
1、if ... then ... else ...

2、if ... then
...
else
...
end if

3、if ... then
...
elseif ... then
...
end if[/QUOTE]


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-08-03 10:00
fnartly
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-7-21
收藏
得分:0 

明白了,我只能说太谢谢你了,我看的教材就没说到这个,
能不能推荐个教材,麻烦你了。

2007-08-03 10:06
盖世豪侠
Rank: 1
等 级:新手上路
威 望:1
帖 子:444
专家分:0
注 册:2007-7-15
收藏
得分:0 

[flash][/flash]
2007-08-03 12:12
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 

楼上的请不要在这罐水可好?


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-08-03 12:24
快速回复:一个新手问题,会的帮个忙,谢谢。
数据加载中...
 
   



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

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