access怎么根据登陆成功与否改变某个字段的值?

来源:百度知道 编辑:UC知道 时间:2024/06/21 19:42:48
<%@LANGUAGE = VBScript.Encode%>
<!--#include file="conn.asp"-->
<%
dim rs,sql,username,regcode,active,password,founderr,msg
username=trim(request("name"))
password=trim(request("password"))
if username="" then
founderr=true
msg="username参数无效!"
else
founderr=false
end if
if password="" then
founderr=true
msg="password参数无效!"
else
founderr=false
end if

if founderr=true then
response.write msg
else
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from reguser where username='"&username&"' and password='"&password&"'"
rs.open sql,conn,1,1
if rs.recordcount>0 then
if trim(rs("regcode"))<>"" then
response.write rs("regcode")

试一下这个:

<%

if (trim(request("name"))<>"" and trim(request("password"))<>"") then

set rs=Server.CreateObject("ADODB.RecordSet")

sql="select * from reguser where username='"&trim(request("name"))&"' and password='"&trim(request("password"))&"'"

rs.open sql,conn,1,1

if not (rs.eof and rs.bof) then

rs("regcode")="yes"

response.write rs("regcode")

rs.close

set rs=nothing

else

rs("regcode")="no"

response.write rs("regcode")

rs.close

end if

end if

%>

用 UPDATE 啊 UPDATE 表 set active='yes' where ...