<!--#include virtual="adovbs.inc" -->
<%
set conn=server.createObject("adobc.connection")
strProvide="provide=sqlloledb;date source=XING-AE809AD14D;initial catalog=asp;user id=sa;password=;"
conn.open strProvede
conn="select * from student"
set rs=conn.Execute(command,recordsAffected,adcmd)
response.write "<table border=3>"
response.write "<tr>"
for i=0 to rs.fields.count-1
response.write "<td>"&ucase(rs(i).name)&"</td>"
next
response.write "</tr>"
while not rs.eof
response.write "<tr>"
for i=0 to rs.filds.count-1
response.write "<td>"&rs(i).value&"</td>"
rs.moveNext
response.write "<tr>"
wend
response.write "</table>"
set conn=nothing
%>
Do Until rs.EOF
response.write "<tr>"
for i=0 to rs.filds.count-1
response.write "<td>"&rs(i).value&"</td>"
rs.moveNext
response.write "<tr>"
Loop
用这种循环试试。
<!--#include file="adovbs.inc" -->
<%
set conn=server.createObject("adodb.connection")
strProvider="Provider=sqloledb;data sourse=XING-AE809AD14D;Initial Catalog=tx1;user id=sa;password=;"
conn.open sreProvide
command="select * from t_student"
set rs=conn.execute(command,recordsAffected,adcmd)
response.write "<table border=3>"
response.write "<tr>"
for i=0 to rs.fields.count-1
response.write "<td>"&ucase(rs(i).name)&"</td>"
next
response.write "</tr>"
while not rs.eof
response.write "<tr>"
for i=0 to rs.filds.count-1
response.write "<td>"&rs(i).value&"</td>"
rs.moveNext
response.write "<tr>"
wend
response.write "</table>"
set conn=nothing
%>
提示这个错误是什么原因呢
HTTP 错误 500.100 - 内部服务器错误 - ASP 错误
Internet 信息服务
--------------------------------------------------------------------------------
技术信息(用于支持人员)
错误类型:
Microsoft VBScript 编译器错误 (0x800A0400)
缺少语句
/个人网站/asp.asp, line 21
wend
浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
网页:
GET /个人网站/asp.asp
时间:
2007年6月30日星期六, 12:37:09