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

<%
newsid=request("id")
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from guestbook where id="&newsid
rs.Open sql,conn,1,1
if request.querystring("action")="edit" then
laccess=Request.Form("laccess")
username=Request.Form("username")
email=Request.Form("email")
qq=Request.Form("qq")
address=Request.Form("address")
home=Request.Form("home")
face=Request.Form("face")
title=Request.Form("title")
head=Request.Form("head")
ip=Request.Form("ip")
content=Request.Form("f3_content")
rs("laccess")=laccess
rs("username")=username
rs("email")=email
rs("qq")=qq
rs("occation")=Address
rs("home")=home
rs("face")=face
rs("title")=title
rs("head")=head
rs("ip")=ip
rs("content")=content
action="ture"
if username="" then
error1="用户不能为空<BR>"
action="false"
end if
if title="" then
error1=error1&"标题不能为空<BR>"
action="false"
end if

if content="" then
error1=error1&"内容不能为空<BR>"
action="false"
end if
if len("content")>total then
error1=error1&"内容超过了"&total&"的限制"
action="false"
end if
if action="false" then

response.redirect("?action=error&error1="&error1&"")
else
rs.update
response.redirect"index.asp"
response.end

end if
elseif request.querystring("action")="" then
%>



显示

Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'

ODBC 驱动程序不支持所需的属性。

/cn/bbs/wriedit.asp,行 9
怎么回事

搜索更多相关主题的帖子: guestbook request address action email 
2005-12-28 13:01
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
sql="select * from guestbook where id="&newsid
rs.Open sql,conn,1,3


红色部分去掉试试!兰色处的 1 改成 3

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

这是修改页面 不给定条件 他还改第一条的纪录 迷糊中 我很菜

2005-12-28 13:13
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
呵呵,是我迷糊了,我还以为是添加记录呢!!

那你先看看你的NEWSID值是否正确!

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2005-12-28 13:20
helminth01
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-12-28
收藏
得分:0 

newsid=request("id")
我是这么取得值 完整的代码
<%@ CODEPAGE = "936" %>
<!--#include file="Connections.asp" -->
<!--#include file="ubb.js" -->
<!--#include file="top.asp" -->
<%
newsid=request("id")
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from guestbook "
rs.Open sql,conn,1,3
if request.querystring("action")="edit" then
laccess=Request.Form("laccess")
username=Request.Form("username")
email=Request.Form("email")
qq=Request.Form("qq")
address=Request.Form("address")
home=Request.Form("home")
face=Request.Form("face")
title=Request.Form("title")
head=Request.Form("head")
ip=Request.Form("ip")
content=Request.Form("f3_content")
rs("laccess")=laccess
rs("username")=username
rs("email")=email
rs("qq")=qq
rs("occation")=Address
rs("home")=home
rs("face")=face
rs("title")=title
rs("head")=head
rs("ip")=ip
rs("content")=content
action="ture"
if username="" then
error1="用户不能为空<BR>"
action="false"
end if
if title="" then
error1=error1&"标题不能为空<BR>"
action="false"
end if

if content="" then
error1=error1&"内容不能为空<BR>"
action="false"
end if
if len("content")>total then
error1=error1&"内容超过了"&total&"的限制"
action="false"
end if
if action="false" then

response.redirect("?action=error&error1="&error1&"")
else
rs.update
response.redirect"index.asp"
response.end

end if
elseif request.querystring("action")="" then
%>


<div align="center">
<center>

<table width="778" border="1" cellspacing="1" cellpadding="4" style="border-collapse: collapse" bordercolor="<%=bgcolor%>">
<form name="form1" method="POST" action="wriedit.asp?action=edit" onkeydown="up()" >
<tr align="center">
<td colspan="2" <%=hColor%> class=tdc1 height="23">签写留言</td>
</tr>
<tr>
<td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>你的名字:</td>
<td bgcolor=<%=tColor2%> class=tdc>
<input name="username" type="text" class=tdc value="<%=rs("username")%>" size="25">
</td>
</tr>
<tr>
<td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>电子邮件:</td>
<td bgcolor=<%=tColor2%> class=tdc>
<input name="email" type="text" class=tdc value="<%=rs("email")%>" size="25">
</td>
</tr>
<tr>
<td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>Q Q 号码:</td>
<td bgcolor=<%=tColor2%> class=tdc>
<input name="qq" type="text" class=tdc value="<%=rs("qq")%>" size="20">
</td>
</tr>
<tr> <%face="images/20.gif"%>
<td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>选择头像:</td>
<td bgcolor=<%=tColor2%> class=tdc>

<select name="face" onChange="document.images['face'].src=options[selectedIndex].value;" class="tdc">
<%
for i=1 to 20
Response.Write "<option "
facestr="images/" & i & ".gif"
if facestr="images/20.gif" then Response.Write "SELECTED "
Response.Write "value='" & facestr &"'>头像" &i &"</option>"
next%>
</select> <img id=face src=<%=face%> alt="头像">头像 <a href=headface.asp target=_blank>查看头像列表</a>
</td>
</tr>
<tr>
<td valign=top align=right width="15%" bgcolor=<%=tcolor2%>
class=tdc>当前心情:</td>
<td bgcolor=<%=tcolor2%>
class=tdc>
<%
Response.Write "<INPUT type=radio value=icon/1.gif name=head checked><img src=""icon/1.gif"">&nbsp;"
for i = 2 to 14
if i =8 then Response.Write "<br>"
Response.Write "<INPUT type=radio name=head value=icon/" & i & ".gif ><img src=""icon/" & i & ".gif"">&nbsp;"
next


%>  </td>
</tr>
<tr>
<td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>来自何方:</td>
<td bgcolor=<%=tColor2%> class=tdc>
<input name="Address" type="text" class=tdc value="<%=rs("occation")%>" size="25">
</td>
</tr>
<tr>
<td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>主页地址:</td>
<td bgcolor=<%=tColor2%> class=tdc>
<input name="home" type="text" class=tdc value="<%=rs("home")%>" size="30">
</td>
</tr>
<tr>
<td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>留言主题:</td>
<td bgcolor=<%=tColor2%> class=tdc>
<input name="title" type="text" class=tdc value="<%=rs("title")%>" size="30">
</td>
</tr>
<tr>
<td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>ubb格式:</td>
<td bgcolor=<%=tColor2%> class=tdc><!--#include file="addubb.asp" --> </td>
</tr>
<tr>
<td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>留言内容:</td>
<td bgcolor=<%=tColor2%> class=tdc>
<textarea name="f3_content" cols="80" rows="8" class=tdc><%=rs("content")%></textarea>
</td>
</tr>
<tr>
<td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>悄悄话:</td>
<td bgcolor=<%=tColor2%> class=tdc>
<input type="checkbox" name="laccess" value="1">只有斑竹才可以看
</td>
</tr>
<tr>
<td width="20%" align="right" bgcolor=<%=tColor2%> class=tdc>
<input type="hidden" name=ip value="<% = o_ip %>">
</td>
<td bgcolor=<%=tColor2%> class=tdc>
<p>
<input type="submit" name="Submit" value="提交" class=bdtj>
<input type="reset" name="Submit2" value="重设" class=bdtj>[按CTRL+ENTER 直接发表]
</td>
</tr>

</form>
</table>

</center>
</div>
<% else%>
<center>
<table width="778" border="1" cellspacing="1" cellpadding="4" style="border-collapse: collapse" bordercolor="<%=bgcolor%>">

<tr>
<td width="20%" align="center" <%=tColor%> class=tdc>错误提示</td>
</tr>
<tr>
<td width="20%" align="center" bgcolor=<%=tColor2%> class=tdc>
<%=request.querystring("error1")%>
<BR> <a href="javascript:history.go(-1)">返回</a>
</td>
</tr>
</table>

</center>
</div>

<%end if%><!--#include file="bq.asp" --></body></html>
还请指教 谢谢

2005-12-28 13:24
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
我的意思是让那检测newsid是否接收到了值,我在你的代码中并没有找到ID在表单元素,在表单action的地址中也没有加 ID=值 这样的东西,很有可能 NEWSID 被赋的空值!

把表但的action改成 action="wriedit.asp?action=edit&id=<%=rs("id")%>" 测测

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2005-12-28 13:33
helminth01
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-12-28
收藏
得分:0 
<% if rstopic2("occation")<>"" then%><%=rstopic2("occation")%>
<%else%>
不告诉你
<%end if%>
<img src="images/pm.gif" width="16" height="16"><a href="write.asp">我要留言</a>

<img src="images/re.gif" width="13" height="12"><a href="reply.asp?l_id=<%=rstopic2("id")%>">回复留言</a> <% If Session("guestbookfeiyue") <> "" Then %> <img src="images/del.gif" width="13" height="12"><a href="del.asp?l_id=<%=rstopic2("id")%>" onClick="{if(confirm('确定要删除该留言以及所有属于此留言的回复吗?')){return true;}return false;}">删除留言</a>
<a href="wriedit.asp?r_id=<%=rstopic2("id")%>">修改留言</a>
<% end if%>
上面是主页部分的代码
<%
newsid=request("id")
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from guestbook "
rs.Open sql,conn,1,3
if request.querystring("action")="edit" then
laccess=Request.Form("laccess")
username=Request.Form("username")
email=Request.Form("email")
qq=Request.Form("qq")
address=Request.Form("address")
home=Request.Form("home")
face=Request.Form("face")
title=Request.Form("title")
head=Request.Form("head")
ip=Request.Form("ip")
content=Request.Form("f3_content")
rs("laccess")=laccess
rs("username")=username
rs("email")=email
rs("qq")=qq
rs("occation")=Address
rs("home")=home
rs("face")=face
rs("title")=title
rs("head")=head
rs("ip")=ip
rs("content")=content
action="ture"
if username="" then
error1="用户不能为空<BR>"
action="false"
end if
if title="" then
error1=error1&"标题不能为空<BR>"
action="false"
end if

if content="" then
error1=error1&"内容不能为空<BR>"
action="false"
end if
if len("content")>total then
error1=error1&"内容超过了"&total&"的限制"
action="false"
end if
if action="false" then

response.redirect("?action=error&error1="&error1&"")
else
rs.update
response.redirect"index.asp"
response.end

end if
elseif request.querystring("action")="" then
%>这是修改部分的代码
你说的 我试过了 呵呵 他还是显示第一条的纪录

2005-12-28 13:42
helminth01
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-12-28
收藏
得分:0 
我感觉就是newsid=request("id")
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from guestbook where id="&newsid
rs.Open sql,conn,1,1
出的问题 怎么 我就搞不懂呀
2005-12-28 13:44
快速回复:求助一下
数据加载中...
 
   



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

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