向SQL数据库追加数据出错

来源:百度知道 编辑:UC知道 时间:2024/05/16 08:42:01
<!--#include file="../../admin/check_admin.asp"-->
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
%>
<% str="select * from article where Id>36354 and Id<36402"
rs.open str,conn,3,3
str2="update article set Fname=Fname+'.htm' where Id>36354 and Id<36402"
rs.close
%>
向Fname里的所有数据追加.htm
执行此代码时没有提示出错 但是并没有成功的向SQL数据库追加数据
在线等 如果解决了 再加100分!
此代码的主要目的是向表article里的Fname这一列里面的数据加上.htm这几个字符!
zcx7221:你的回答不对啊!

<!--#include file="../../admin/check_admin.asp"-->
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
%>
<%

str2="update article set Fname=Fname+'.htm' where Id>36353 and Id<36403"
rs.open str2,conn,3,3
rs.close

%>

没太看动你的意思~~好象是:
str2="update article set Fname=Fname+'.htm' where Id>36354 and Id<36402"
这句有错(应该是这里,但不太会改,试试先),改成:
str2="update article set Fname=Fname"+'.htm'+ "where Id>36354 and Id<36402"

如果不对,你告诉我你要做什么,我想想,..

呵呵,str2没错啊,只不过就象2楼说的那样,str2的那条语句并没有被提交到数据库执行
str并没有起作用,可以删掉,直接
str2="update article set Fname=Fname+'.htm' where Id>36354 and Id<36402"
rs.open str2,conn,3,3
就OK了

主要是你的str2语句没有执行

可以借助Command对象来处理

谁来帮助一下啊!