回复 2楼 ysf0181
上面的有些看不懂,下面是显示全部字段名和值的代码,请高手帮改下看能达到目的否,十分感谢!<%@ language=VBScript %>
<%
dim connstr
connstr="provider=Microsoft.jet.oledb.4.0;data source=" &server.mappath("mydata.mdb")
set conn=server.createobject("adodb.connection")
conn.open connstr
%>
<%
dim TabelName,i,rs
TableName="type" '这里设置数据库中的特定表名
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from "&TableName&" where 类型='简略型'",conn,1,1 '对指定数据库表进行查询
response.write "<table border=""1"">"
response.write "<tr bgcolor=""#cccccc"">"
for i=0 to rs.fields.count-1
response.write "<th>"&rs.fields(i).name & "</th>" '输出表中所有字段名
next
response.write "</tr>"
'开始输出所有记录值
do while not rs.eof
response.write "<tr bgcolor=""#ffffff"">"
for i=0 to rs.fields.count-1
response.write "<td>"
if isnull(rs.fields(i).value) then
response.write ""
elseif rs.fields(i).value="" then
response.write "空"
else
response.write server.HTMLEncode(rs.fields(i).value)
end if
response.write "</td>"
next
rs.movenext
response.write "</tr>"
loop
response.write "</table>"
%>
[ 本帖最后由 ASP入门者 于 2013-1-25 01:31 编辑 ]