十万火急!

lgyqd 2005-09-27 06:41:01
本人做了一个后台管理,但现在有问题,!!!我点击"编辑"后添加数据,但无法保存!
Microsoft JET Database Engine (0x80040E14)
语法错误 (逗号) 在查询表达式 'id=44, 45, 46, 47, 48, 57, 58, 59' 中。
/WebApplication1/project.asp, 第 58 行
源码如下:
请大家帮忙,明天要交任务!谢谢!

<%set rs=Server.CreateObject("adodb.recordset")

if request("add")<>"" then
'判断添加

sql="select * from db"
rs.Open sql,conn,1,3
rs.AddNew

rs("username")=request("username")
rs("password")=request("password")
rs.update
id=rs("id")
rs.close
edit="edit"

else
'判断保存还是编辑

if request("save")<>"" then
username=request("username")
password=request("password")
'判断保存

sql="select * from db where id="&request("id")

'sql="update db set username='"&username&"',password='"&password&"' where id="&clng(request("id"))
rs.open sql,conn,1,3

rs("username")=username

' response.Write username
rs("password")=password
'conn.execute(sql)
rs.Update
rs.Close


else
'编辑
id=request("id")
edit=request("edit")


end if
end if


%>


<table width="608" border="3" bordercolor="blue" ID="Table2">
<tr>
<td width="90"><p align="center">序号</p>
</td>
<td width="90"><p align="center">用户名</p>
</td>
<td width="90"><p align="center">密码</p>
</td>
<td width="200" colspan="3"><p align="center">   操作</p>
</tr>

<%


sql="select * from db"

rs.Open sql,conn,1,1

if rs.bof and rs.eof then
response.write "还没有管理员!"
response.End
else
if not rs.eof then

rs.PageSize=10
page = CInt(Request("Page"))
If page<=1 Then Page=1
If page>=rs.PageCount Then page=rs.PageCount
rs.AbsolutePage=page
i=page+(page-1)*9
For iPage=1 To rs.PageSize

%>

<form action="admin.asp" method="post" ID="Form2">
<input type=hidden name=id value="<%=rs("id")%>">
<tr>

<%if edit<>"" and cint(id)=cint(rs("id")) then%>
<td width="90"><%=rs("id")%></td>
<td width="90"><input type="text" name=username value="<%=rs("username")%>" ID="Text1"></p>
</td>
<td width="90"><input type="text" name=password value="<%=rs("password")%>" ID="Text4"></p>
</td>

<%else%>

<td width="90"><p align="center"> <%=rs("id")%></p></td>
<td width="90"><p align="center"> <%=rs("username")%></p>
</td>
<td width="90"><p align="center"> <%=rs("password")%></p>
</td>
<%end if%>
<td width="90"><div align="center"><a href="del.asp?id=<%=rs("id")%>" onclick="return confirmdel();">删除
</a></div></td>
<%if edit<>"" and cint(id)=cint(rs("id")) then%>


<td width="90"><div align="center"><input type=submit name="save" value="存盘"></div></td>
<%else%>

<td width="90"><div align="center"><input type=submit name="edit" value="编辑"></a></div></td>
<%end if%>

</tr></form>
<%
rs.movenext
if rs.eof then exit for
i=i+1%>
<%next%>

<form action="admin.asp" method="post" ID="Form1">
<table border="1" width="608" ID="Table1">
<tr>
<td width="200" colspan="6"><p align="right">            
<input type="submit" name="add" value=" 添 加 " ID="Submit1"></td>
</td>
</table>
</form>


<%end if
end if%>
<% rs.Close
set rs=nothing
conn.close
set conn=nothing
%>

...全文
53 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
hansonboy 2005-09-28
  • 打赏
  • 举报
回复
'id=44, 45, 46, 47, 48, 57, 58, 59'
怎么添加或修改中这个id会有这么多值的??????你搞了个多选框出来吗?
fengloveyan 2005-09-28
  • 打赏
  • 举报
回复
字段相符吗?
id 怎么设置

28,406

社区成员

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

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