'users.user_name' 不能是零长度的字符串,改了数据库中的属性,结果没有更改
<html>
<head>
<title> 更新 </title>
</head>
<body>
<%
dim user1_id
user1_id=session( "id ")
if request.form( "user_name ") <> " " then
dim db
set db=server.createobject( "adodb.connection ")
db.open "dbq= "&server.mappath( "userinfo.mdb ")& ";driver={microsoft access driver (*.mdb)} "
dim user_name,real_name,tel,email
user_name1=request.form( "user_name ")
real_name1=request.form( "real_name ")
tel1=request.form( "tel ")
email1=request.form( "email ")
dim stra,rs
Stra= "update users Set user_name= ' "&user_name& " ',real_name= ' "&real_name& " ',tel= ' "&tel& " ',email= ' "&email& " ' Where id= " &user1_id
db.execute(stra)
response.Redirect( "8-5.asp ")
else
response.write "请您完整输入数据 "
end if
%>
</body>
</html>
感觉就是这一句:
Stra= "update users Set user_name= ' "&user_name& " ',real_name= ' "&real_name& " ',tel= ' "&tel& " ',email= ' "&email& " ' Where id= " &user1_id
错在哪里了?我把数据库中的属性设置为可以为空,结果我试了三个字段,结果这三个字段都是空职,郁闷?
------解决方案--------------------user_name==> user_name1
------解决方案--------------------user_name1=request.form( "user_name ")
real_name1=request.form( "real_name ")
tel1=request.form( "tel ")
email1=request.form( "email ")
变量后都带1, 你写的update SQL变量都不带1, 有数据才怪.