KAO 多去读读书, SQL语句中的四大语句select、UPDATE、DELETE,INSERT都是必学的
假定数据库服务器名为msql,用户名为sa,密码为sa,数据库名 databasename,表名为mytable 表中原用户名为system,原密码为1,表单对象名分别为myid和mypass: <% dim myname myname = request.form("myid") mypass = request.form("mypass") Set conn = Server.CreateObject("ADODB.Connection") sql="DRIVER={SQL Server};SERVER=msql;UID=sa;PWD=sa;DATABASE=databasename" conn.open sql set rs=conn.execute("select * from mytable where USER_ID='"&myname&"' and USER_PWD='"&mypass&"'") if rs.eof then response.write "error userid or pass" response.end end if rs.close() set rs = conn.execute("update mytabel set USER_PWD='"&mypass&"' where USER_ID='"&myname&"'") rs.close() conn.close() set rs=nothing set conn=nothing %>自己多考虑一下安全问题和错误处理就可以了!
然后涌connection对象执行梅花雨地sql语句
多去读读书,
SQL语句中的四大语句select、UPDATE、DELETE,INSERT都是必学的
表中原用户名为system,原密码为1,表单对象名分别为myid和mypass:
<%
dim myname
myname = request.form("myid")
mypass = request.form("mypass")
Set conn = Server.CreateObject("ADODB.Connection")
sql="DRIVER={SQL Server};SERVER=msql;UID=sa;PWD=sa;DATABASE=databasename"
conn.open sql
set rs=conn.execute("select * from mytable where USER_ID='"&myname&"' and USER_PWD='"&mypass&"'")
if rs.eof then
response.write "error userid or pass"
response.end
end if
rs.close()
set rs = conn.execute("update mytabel set USER_PWD='"&mypass&"' where USER_ID='"&myname&"'")
rs.close()
conn.close()
set rs=nothing
set conn=nothing
%>自己多考虑一下安全问题和错误处理就可以了!