关于数据库检验的问题,不知是不是这样写,请指教???/
1.set newconn=server.createobject("adodb.connection")
2.dbpath=server.mappath("mydata.mdb")
3.constr="driver={microsoft access driver(*.mdb)};dbq="&dbpath
4.newconn.open constr
5.sqlstr="select * from stock where aid='"&id&"' and apass="&pass&""
6.set rs=server.createobject("adodb.recordset")
7.rs.open sqlstr
8.if rs.eof then
9.response.redirect shangyi.htm
10.response.write "<script> alert('不存在的用户,你不本站会员');</script>"
11.response.end
12.else
13.response.redirect huang.htm
14.end if
第一个问题:到这之后,我想再在这个数据库中再提取其它条件的数据库,
那么需不需要重写1--7句呢, 或者是不需要重写1--7句,直接接着15.16句改变一下条件就可以呢???
15.sqlstr2="select * from stock where aid='"&id&"' and apass<>"&pass&""
16.rs.open sqlstr2
17.if not rs.eof then
18 response.redirect shangyi,htm
19.response.write"<script>alert('该账号存在,但密码错误');</script>"
20.response.end
21.end if
第二个题:这段程序是说当用户名和密码都对的时候,就进入会员区,当用户名对,密码不对的时候,提示用户存在,密码不对,(至于还有其它的情况,暂进先不说,就说这两个)我想问我这样的检验合理吗?? 如果不合理,希望把好一点的方法指教给我一下,不盛感激!!