'開啟資料庫
Dim Conn
Set Conn=server.createobject("adodb.connection")
Conn.Open ConnStr
%>
<html>
<head>
<title>ASP Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<table>
<%
Dim rs, rs1,strSQL, Field, strResponse,cmd,rs2
Set rs = Server.CreateObject("ADODB.Recordset") '建立記錄集對象
Set cmd = Server.CreateObject("ADODB.Command") '建立命令對象
set cmd.ActiveConnection=Conn
cmd.CommandText="aaa"
cmd.CommandType = 4 '命令類別為4,表示為預存程序
set rs =cmd.execute
Do Until rs is nothing
'輸出表頭
strResponse = "<tr>"
For Each Field In rs.Fields
strResponse = strResponse & "<td>" & Field.Name & "</td>"
Next
strResponse = strResponse & "</tr>"
'輸出表體
Do Until rs.EOF
strResponse = strResponse & "<tr>"
For Each Field In rs.Fields
strResponse = strResponse & "<td>" & rs(Field.Name) & "</td>"
Next
strResponse = strResponse & "</tr>"
rs.MoveNext
Loop
Set rs = rs.NextRecordset()
Loop
Set rs = nothing
Response.Write (strResponse)
%>
</table>
</body>
</html>
<%
Conn.Close()
Set Conn = nothing
%><script runat="server">