<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Tìm theo mã sv</title>
</head>
<!--#include file="connect.asp"-->
<%
tieuchi=request.form("tim")
m=request.form("ma")
l=request.form("lop")
ht=request.form("ten")
moketnoi
' kiểm tra xem người dùng chọn tiêu chi tìm kiếm nào
set sv=server.createobject("ADODB.recordset")
' Neu tim kiem theo ma sv
if tieuchi="1" then
' Do mã sv là dạng number nên khi so sánh với chuỗi ma sv nhập vào từ bàn phím phải chuyển sang dạng string --> nếu không sẽ sinh ra data mismatch
sv.open "select * from hienthi where cstr(masv)='"&m&"'",cn,3,3
end if
'Neu tim kiem theo tenlop
if tieuchi="2" then
sv.open "select * from hienthi where tenlop='"&l&"'",cn,3,3
end if
if tieuchi="3" then
sv.open "select * from hienthi where hoten like'%"&ht&"'",cn,3,3
end if
response.write("Ket qua tim kiem !")
%>
<table border="1" width="100%" id="table1">
<tr>
<td>Mã sv</td>
<td>Lớp học</td>
<td>Họ tên</td>
<td>Ngày sinh</td>
<td>Giới tính</td>
</tr>
<% do while not sv.eof %>
<tr>
<td><%=sv("masv")%></td>
<td><%=sv("tenlop")%></td>
<td><%=sv("hoten")%></td>
<td><%=sv("ngaysinh")%></td>
<td><%=sv("gioitinh")%></td>
</tr>
<% sv.movenext
loop
dongketnoi
%>
</table>
Bạn đang đọc truyện trên: Truyen2U.Com