<%
Set conn = Server.CreateObject("ADODB.Connection")
ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/db1.mdb")
conn.Open ConnStr
Set rs = Server.CreateObject("ADODB.Recordset")
SQLSTR = "select * from grade"
rs.Open SQLSTR, conn,3,1
%>
<body>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="200">
<tr>
<td width="25%">學號</td>
<td width="25%"><%=rs(1).name%> </td>
<td width="25%"><%=rs(2).name%> </td>
<td width="25%" align="right"><%=rs(3).name%> </td>
</tr>
<%
while not rs.eof
%>
<tr>
<td width="25%"><%=rs(0)%> </td>
<td width="25%"><%=rs(1)%> </td>
<td width="25%"><%=rs(2)%> </td>
<td width="25%" align="right"><%=rs(3)%> </td>
</tr>
<%
rs.movenext
wend
%>
</table>
<input type="button" name="SaveAs" value="轉存EXCEL檔" onclick="document.execCommand('SaveAs', true, 'test.xls');">
</body>
<%
rs.close
set rs = nothing
set conn = nothing
%>