<html>
<body bgcolor="#EBC79E">
<h3>修改图书</h3>
<br><br><br><br>
<%
Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName,ConnStr,Conn
SqlDatabaseName = "book"
'SQL数据库名
SqlUsername = "admin"
'SQL数据库用户名
SqlPassword = "111111"
'SQL数据库用户密码
SqlLocalName = "(local)"
'SQL主机IP地址(本地可用“127.0.0.1”或“(local)”,非本机请用真实IP)
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnStr
set rs = Server.CreateObject("ADODB.recordset")
'sql="update book set bname='"&request.form("bname")&"',author='"&request.form("author")&"' ,pub_date='"&request.form("pub_date")&"',publish='"&request.form("publish")&"',price='"&request.form("price")&"' ,state='"&request.form("state")&"',family='"&request.form("family")&"',location='"&request.form("location")&"' where bno='"&request.form("bno")&"'"
Response.write(request.form("bname") )
sql = "update book set bname='" & request.form("banme") & "' where bno='" & request.form("bno") & "'"
'sql = "update book set bname='3a2b',author='3a2b' where bno='1'"
rs.open sql,conn,1,3
%>
<br>
<%=request.form("bname")%>
修改成功
<%
conn.close
%>
</body>
</html>
注释掉的第一句sql和没注释的第二句sql都能执行,但是执行完更新成功0行
第三局静态的sql可以执行,更新成功
求教哪里出问题了啊
asp,sql,update
------解决方案--------------------
检查下
request.form("bno")
是否能获取到值呢
------解决方案--------------------
Response.Write sql
一看就明白了
看是否合法