注册 登录
编程论坛 ASP技术论坛

数据库更新问题 请指教

月夜 发布于 2007-09-05 11:39, 464 次点击
<!--#include file="conn.asp"-->
<%
Dim tpbts,tpfls,tpxxs,user1,id
tpbts=request.Form("tpbt")
tpfls=request.Form("tpfl")
tpxxs=request.Form("tpxx")
If session("users")<>"" Then
user1=session("users")
Else
user1="guest"
End If
Call openDB()
sql="select top 1 * from img order by id desc"
rs.open sql,conn,1,1
id=rs("id")
sql="update img set bt='"&tpbts&"',fl='"&tpfls&"',js='"&tpxxs&"',user='"&user1&"' where "&id&")"
conn.Execute(sql)
Call closeDB()
%>

提示错误
___________________________________________________________________________
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] 多余的 ) 在查询表达式 '36)' 中。
/xc/tpxx.asp, 第 17 行
7 回复
#2
月夜2007-09-05 11:44
有兄弟帮忙么 - -!
#3
hmhz2007-09-05 11:46
sql="update img set bt='"&tpbts&"',fl='"&tpfls&"',js='"&tpxxs&"',user='"&user1&"' where "&id&")"

很明显的错误,有这样查询的吗?
#4
月夜2007-09-05 11:49
-啊哦 ASP初学者 请指教该如何改正
#5
hmhz2007-09-05 11:51
sql="update img set bt='"&tpbts&"',fl='"&tpfls&"',js='"&tpxxs&"',user='"&user1&"' where &id&")"

改成

sql="update img set bt='"&tpbts&"',fl='"&tpfls&"',js='"&tpxxs&"',user='"&user1&"' where id="&id
#6
steven10132007-09-05 12:07
换成这个试试
sql="update img set bt='"&tpbts&"',fl='"&tpfls&"',js='"&tpxxs&"',user='"&user1&"' where id='"&id&"'"
#7
lecojason2007-09-05 12:24

不用SQL=, 直接用conn.execute"update img set bt='"&tpbts&"',fl='"&tpfls&"',js='"&tpxxs&"',user='"&user1&"' where id="&id
快一点.

#8
flynet2007-09-05 13:34
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from img where id="&ID,conn,3,3
rs("bt")=tpbts
rs("fl")=tpfls
rs("js")=tpxxs
rs("user")=user1
rs.update()
1