<%
yzzh=session("sjcky_adminname")
set rslx_admin=server.createobject("adodb.recordset")
sqllx_admin = "select lx_power from lx_admin where lx_username ='"&yzzh&"' "
rslx_admin.open sqllx_admin,conn,1,1
dengji = rslx_admin("lx_power")
set rsstudent=server.createobject("adodb.recordset")
sqlstudent = "select * from student where class like '%东关%' order by adid desc"
rsstudent.open sqlstudent,conn,1,1
if rsstudent.eof and rsstudent.bof then
response.write "<SCRIPT LANGUAGE=JavaScript>alert (' 抱歉暂时没有数据!');window.location.href='admin_head_sjcky.asp';</script>"
else
if dengji = 2 then
%>
怎么修改 为 管理员为 东关街 包含 东关 的 查询出来 帮帮忙
like '%东关%' 这个值 为 自动截取 yzzh=session("sjcky_adminname") 的前2为值 并查询
------解决方案--------------------
Dim UserName,aSQLstring,sSQLstring
UserName=Session("sjcky_adminname")
Set aRs=Server.CreateObject("ADODB.RecordSet")
aSQLstring = "select lx_power from lx_admin where lx_username ='"&yzzh&"'"
aRs.Open SQLstring,Conn,1,1
IF Not aRs.EOF Then
DengJi=aRs(0)
Set sRs=Server.CreateObject("ADODB.RecordSet")
sSQLstring="select * from student where class like '%"& Left(UserName,2)&"%' order by adid desc"
sRs.Open sSQLstring,Conn,1,1
IF Not sRs.EoF Then
Do While Not sRs.EoF
Response.Write(Rs(0) & "<br>")
Rs.MoveNext:Loop
Else
Response.Write "<SCRIPT LANGUAGE=JavaScript>alert('抱歉暂时没有数据!');window.location.href='admin_head_sjcky.asp';</script>"
Response.End()
End IF
End IF