问题描述
- 如何将access数据库中的某项数据导入到excel
-
如何将access数据库中的某项数据导入到指定excel的工作薄中
解决方案
先查询出数据,然后循环写入。java用poi,.net用npoi写入excel,具体google下。
解决方案二:
下面是我用Vb写的一段Access的数据导入excel的程序
Dim i As Integer, r As Integer, c As Integer
Dim newxls As Excel.Application
Dim newbook As Excel.Workbook
Dim newsheet As Excel.Worksheet
Set newxls = CreateObject("Excel.Application")
Set newbook = newxls.Workbooks.add
Set newsheet = newbook.Worksheets(1)
If Adodc1.Recordset.RecordCount > 0 Then
For i = 0 To DataGrid1.Columns.Count - 1
newsheet.Cells(1, i + 1) = DataGrid1.Columns(i).Caption
Next i
Adodc1.Recordset.MoveFirst
Do Until Adodc1.Recordset.EOF
r = Adodc1.Recordset.AbsolutePosition
For c = 0 To DataGrid1.Columns.Count - 1
DataGrid1.Col = c
newsheet.Cells(r + 1, c + 1) = DataGrid1.Columns(c)
Next c
Adodc1.Recordset.MoveNext
Loop
newxls.Visible = True
End If
希望能帮你!
解决方案三:
Excel数据导入到数据库中