To modify the code

<%
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 '%Dong Guan%' order by adid desc"

rsstudent.open sqlstudent,conn,1,1
if rsstudent.eof and rsstudent.bof then
response.write "<SCRIPT LANGUAGE=JavaScript>alert (' Sorry, there is no data!');window.location.href='admin_head_sjcky.asp';</script>"
else
if dengji = 2 then
%>


How to out do me a favor to query manager Dong Guan Jie contains Dongguan
like '%Dongguan%. This value is automatically intercept yzzh=session ("sjcky_adminname") before the 2 as the value and the query

Started by Nikita at November 07, 2016 - 4:19 PM

left(yzzh,2)

Posted by Richard at November 11, 2016 - 4:28 PM

I didn't understand you want to explain what.

Posted by Norman at November 22, 2016 - 5:12 PM

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('Sorry, there is no data!');window.location.href='admin_head_sjcky.asp';</script>"
		Response.End()
	End IF
End IF

Posted by Norman at December 03, 2016 - 5:29 PM