注册 登录
编程论坛 ASP技术论坛

access 数据写进 excel 对吗?

xiongjl9555 发布于 2008-08-13 23:39, 784 次点击
我想将数据库access 中的数据写进 excel 表格中,这样写对吗?当然前面有连接数据库的语句。
set Exrs=server.CreateObject("adodb.recordset")
sql="select * from incident order by id desc"
Exrs.Open sql,conn,1,1
Exrs.movefirst
i=2
 do while not Exrs.EOF
    objExcel.Cells(i, 1).Value =Exrs("id")      
    objExcel.Cells(i, 2).Value =Exrs("姓名")
    objExcel.Cells(i, 3).Value =Exrs("住址")
    objExcel.Cells(i, 4).Value =Exrs("电话号码")
  
    i = i + 1
    Exrs.movenext
Loop
Exrs.close
0 回复
1