stuinfotoexcel.asp
来自「成绩管理代码 采取的研究方法:采用网络编程技术」· ASP 代码 · 共 43 行
ASP
43 行
<%
if session("type")<>"999" then
response.write "<br><br>对不起,您没有权限使用导入excel的权限!"
response.end
end if
Response.ContentType = "application/vnd.ms-excel"
set conntemp=server.createobject("adodb.connection")
cnpath="DBQ=" & server.mappath("../data/yzbzcj2007.mdb")
conntemp.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & cnpath
sql="select * from stuinfo"
set RS=conntemp.execute(sql)
%>
<TABLE BORDER=1><tr>
<%
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' % Loop through Fields Names and print out the Field Names
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
j = 2 'row counter
'For i = 1 to RS.Fields.Count - 7
Response.Write "<td><B>学号<B></td><td><B>姓名<B></td><td><B>性别<B></td><td><B>民族<B></td><td><B>出生日期<B></td><td><B>级部<B></td><td><B>班级<B></td><td><B>入学日期<B></td><td><B>家长姓名<B></td><td><B>联系电话<B></td><td><B>家庭住址<B></td><td><B>备注<B></td>"
'next
%> </tr>
<%
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' % Loop through rows, displaying each field
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Do While Not RS.EOF
%>
<TR>
<% For i = 1 to RS.Fields.Count - 7
%>
<TD VALIGN=TOP><% = RS(i) %></TD>
<% Next %>
</TR> <%
RS.MoveNext
j = j + 1
Loop
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' % Make sure to close the Result Set and the Connection object
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RS.Close %>
</TABLE>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?