xu ly sua sv

Màu nền
Font chữ
Font size
Chiều cao dòng

<!--#include file="connect.asp"--><head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>

<%

l=request.form("lop")

t=request.form("ten")

moketnoi

set sinhvien=server.createobject("ADODB.recordset")

' Dùng query timkiem tìm kiếm sinh viên có tên lớp và họ tên nhập vào từ bàn phím

sinhvien.open "select * from timkiem where tenlop='"&l&"' and hoten='"&t&"'",cn,3,3

%>

<form method="POST" action="suavahienthi.asp">

M sv : <input type="text" name="masv" size="20" value=<%=sinhvien("masv")%> readonly>

Lớp :

<label>

<select name="malop">

<%

set lop=server.CreateObject("ADODB.recordset")

lop.open "select * from lophoc",cn

do while not lop.eof

'Nếu trong quá trình thêm từng lớp vào combobox mà mã lớp đó trùng với mã lớp của sv vừa tìm thấy ở trên thì giá trị này sẽ được chọn ( thêm thuộc 'tính selected)

if lop("malop")=sinhvien("malop") then

%>

<option value="<%=lop("malop")%>" selected><%=lop("tenlop")%></option>

<% 'còn nếu mã lớp không trùng với mã lớp của sinhvien tìm được ở trên thì chỉ thêm vào combobox chứ không chọn .

else

%>

<option value="<%=lop("malop")%>"><%=lop("tenlop")%></option>

<% end if

lop.movenext

loop

lop.close

set lop=nothing

%>

</select>

</label>

Ho ten : <input type="text" name="hoten" size="20" value=<%=sinhvien("hoten")%>>

ngay sinh : <input type="text" name="ngaysinh" size="20" value=<%=sinhvien("ngaysinh")%>>

gioitinh : <input type="text" name="gioitinh" size="20" value=<%=sinhvien("gioitinh")%>>

<input type="submit" value="Sửa" name="B1"><input type="reset" value="Reset" name="B2">

</form>

Bạn đang đọc truyện trên: Truyen2U.Pro

#tong#van