我有一个mdb数据库,里面存储了人名,地址,电话, 我想在asp页面上增加一个按钮,用来导出这些信

2025-01-01 11:06:04
推荐回答(1个)
回答1:

首先你要建立一个到数据库的连接,比如这个连接名叫cn, 下面是先建立一个结果集,然后输入表格

set rs = server.createobject("adodb.recordset")
rs.open"select * from 表名",cn,adOpenStatic,4
response.write"

"
response.write""

for i=0 to rs.fields.count-1
response.write""
next
response.write""
while not rs.eof
response.write""

for j=0 to rs.fields.count-1
response.write""
next
response.write""
rs.movenext
wend
response.write"
"&rs.fields(i).name&"
"&rs.fields(j).value&"
"