问题描述
- 关于ASP的一个编辑修改按钮
-
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.open "provider=SQLOLEDB;DATA SOURCE=127.0.0.1;UID=sa;pwd=ccjiee;DATABASE=dog"
edi=cint(Request("ediid"))
Strsql="select * from dogarticle where dogid="&edi
set rs = Server.CreateObject("ADODB.recordset")
rs.open strsql,conn,1,3
UPDATE dogarticle SET "title ='" & request.Form("title") & "', article ='" & request.Form("article") & "',dogid='" & request.Form("dogid") & "' where dogid='" & edi &"'"
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
问下这么写可以吗?错哪了?
UPDATE dogarticle SET "title ='" & request.Form("title") & "', article ='" & request.Form("article") & "',dogid='" & request.Form("dogid") & "' where dogid='" & edi &"'"
这句一直显示语句未结束
解决方案
首先你格式用法都搞错了,有两种方式,如果你要直接update 可以这样写
rs.execute "UPDATE dogarticle SET "title ='" & request.Form("title") & "', article ='" & request.Form("article") & "',dogid='" & request.Form("dogid") & "' where dogid='" & edi &"'"
解决方案二:
这样
conn.execute "UPDATE dogarticle SET "title ='" & request.Form("title") & "', article ='" & request.Form("article") & "',dogid='" & request.Form("dogid") & "' where dogid='" & edi &"'"
解决方案三:
另一种
rs.open strsql,conn,1,3
title ='" & request.Form("title")
.....
rs.Update
时间: 2024-10-08 04:12:57