现有数据源DSN(test)用户名为z;密码为123456;有一个test数据库理由一个叫table的表,表中有三个列:用户名;×××号码;电话号码,怎样该表中的输出所有字段?
下面的代码正确吗?请多指教
<html>
<head>
<title>列出所有列</tiltle>
</head>
<body>
<%
Dim Conn,Rs,Str
set Conn=server.createobject("Adodb.Connection")
Conn.open"DSN=test;UID=z;PWD=123456"
Set Rs=server.createobject("Adodb.Recordset")
Str="select*from table"
Rs.open Str,conn,3,3
If not Rs.Eof then
Response.Write("<table border=1>")
For i=1 To Rs.recordcount
If not Rs.Eof
Response.Write("<tr>")
Response.Write("<td>")
Response.Write("Rs("用户名")")
Response.Write("</td>")
Response.Write("<td>")
Response.Write("Rs("×××号码")")
Response.Write("</td>")
Response.Write("<td>")
Response.Write("Rs("电话号码")")
Response.Write("</td>")
Response.Write("</tr>")
Rs.MoveNext
End If
Next
Response.Write("</table>")
End If
Rs.close
set Rs=nothing
%>
</head>
</html>