§Ò ¸n M«n häc
Sinh Viªn : TrÇn Trung ThuËn
if rs(Ma)=Cur Then
Response.write(" Selected")
End if
%>><%=rs(Ma)%>: <%=rs(Ten)%></option><%
rs.MoveNext
Loop
Response.write("</select>")
rs.close
End Sub
''''''''''''''''''''''''''''''''''''''''''
Sub ListBoxTrang(Name,num,cur,Submit)
Dim i
%><select name='<%=Name%>' style='font-family: .VnTime; font-
size=12pt'<%
If Submit Then
Response.write(" onChange='submit()'>")
Else
Response.write(">")
End if
For i=1 to num
%><option value='<%=i%>'<%
If i=cur Then
Response.write(" selected")
End if
%>><%=i%></option><%
Next
ResPonse.write("</select>")
End Sub
''''''''''''''''''''''''''''''''''''''''''
Function MyFilter(vMaVung,vHo,vTen,vDiaChi,vSDT)
Dim strTemp
strTemp=""
if vMaVung<>"" then
strTemp=strTemp+" And MaVung='"+vMaVung+"'"
end if
if vHo<>"" then
strTemp=strTemp+" And InStr(Ho,'"+vHo+"')"
§Ò ¸n M«n häc
Sinh Viªn : TrÇn Trung ThuËn
end if
if vTen<>"" then
strTemp=strTemp+" And Ten='"+vTen+"'"
end if
if vDiaChi<>"" then
strTemp=strTemp+" And InStr(DiaChi,'"+vDiaChi+"')"
end if
if vSDT<>"" then
strTemp=strTemp+" And SoDienThoai='"+vSDT+"'"
end if
MyFilter=strTemp
end Function
''''''''''''''''''''''''''''''''''''''''''
Function ShowData(Query,CurrentPage,Selected)
Dim i
set RsTemp= server.CreateObject("ADODB.recordset")
'RsTemp.CursorLocation=3
'RsTemp.PageSize=2
RsTemp.open Query,Conn
'i=0+CurrentPage
'CurrentPage=1
'CurrentPage=i
'RsTemp.AbsolutePage = CurrentPage
i=0
Do while Not RsTemp.Eof 'And
RsTemp.AbsolutePage=CLng(CurrentPage)
i=i+1
%><tr><td align=center><%=i%></td><%
%><td align='center'><input type='checkbox'
name='Cb(<%=RsTemp.Fields("Id")%>)' value='1'></td><%
if Cint(Selected)=RsTemp.Fields("Id") then
%><td align='center'><input type='radio' name='Rb'
value='<%=RsTemp.Fields("Id")%>' onclick='submit()'
checked></td><%
else
%><td align='center'><input type='radio' name='Rb'
value='<%=RsTemp.Fields("Id")%>' onclick='submit()'></td><%
Đề án Môn học
Sinh Viên : Trần Trung Thuận
end if
%><td align='left'><%=RsTemp.Fields("Ho")+" "+
RsTemp.Fields("Ten")%></td>
<td align='left'><%=RsTemp.Fields("SoDienThoai")%></td>
<td align='left'><%=RsTemp.Fields("MaVung")%></td><%
RsTemp.MoveNext
Loop
Response.write("</table>")
ShowData=RsTemp.PageCount
RsTemp.close
Set RsClose=nothing
End Function
%>
Mã nguồn trang tìm kiếm
<! #include file=Connection.inc >
<%
Header
FormTimKiem()
Footer
%>
<! #include file=Lib.asp >
Mã nguồn trang in kết quả tìm kiếm
<! #include file=Connection.inc >
<%
'Dim CurrentPage
DiaBan=Trim(Request("DiaBan"))
Ho=Trim(Request("Ho"))
Ten=Trim(Request("Ten"))
DiaChi=Trim(Request("DiaChi"))
DienThoai=Trim(Request("DienThoai"))
Query="Select * from SoDanhBa Where True"
Query=Query+MyFilter(DiaBan,Ho,Ten,Diachi,DienThoai)
'Response.write Query
rs.CursorLocation=3
§Ò ¸n M«n häc
Sinh Viªn : TrÇn Trung ThuËn
'rs.PageSize=2
rs.open Query, Conn
'NumPage= rs.PageCount
Header()
'Response.write rs.RecordCount
%>
<blockquote>
<p><font face=".VnArialH" size="5" color="#000080"><strong>KÕt qu¶
t×m kiÕm</strong></font></p>
</blockquote>
<%
if rs.RecordCount>0 then
%>
<FORM METHOD=POST ACTION="">
<table border="0" width="100%" bgcolor="#008080" cellspacing="0"
cellpadding="0"
height="34">
<tr>
<td width="80%" height="34"><font color="#FFFFFF"><strong>
T×m thÊy <%=rs.RecordCount%> kÕt qu¶ </strong></font></td>
</tr>
</table>
<table border="0" width="100%" bgcolor="#008080" cellspacing="0"
cellpadding="0">
<tr>
<td width="100%">
<table border="0" width="100%" cellspacing="1">
<%
rs.MoveFirst
i=0
'rs.AbsolutePage=CLng(Page1)
Do While not rs.Eof 'And rs.AbsolutePage=CLng("1")
i=i+1
%>
<tr>
§Ò ¸n M«n häc
Sinh Viªn : TrÇn Trung ThuËn
<td width="5%" bgcolor="#FFFFFF" align="center"><font
color="#800000"><%=i%></font></td>
<td width="75%" bgcolor="#FFFFFF"><font
color="#0000FF"><strong>
<%=rs("Ho")%><%=" "%><%=rs("Ten")%></strong></font><br>
<%=rs("DiaChi")%></td>
<td width="21%" bgcolor="#FFFFFF" align="center"><font
color="#FF0000"><strong>(<%=rs("MaVung")%>)<%=rs("SoDienThoai")%
></strong>
</font></td>
</tr>
<%
rs.MoveNext
Loop
%>
</table>
</td>
</tr>
</table>
<table border="0" width="100%" bgcolor="#008080" cellspacing="0"
cellpadding="0"
height="34">
<tr>
<td width="80%" height="34"><font color="#FFFFFF"><strong>
T×m thÊy <%=rs.RecordCount%> kÕt qu¶ </strong></font></td>
</tr>
</table>
</FORM>
<%
else
%>
<br><br><center>
<b><font face="VnArial" size="5" color="#FF0000">Kh«ng t×m thÊy kÕt
qu¶</font></b>
<center>
<%