access数据库转成excel数据库如何实现?
access数据库转成excel数据库如何实现?小弟出来乍道,跪求各位大侠帮助。
我链接上了数据库,但是没办法操作excel
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Dim pWorkspaceFactory As IWorkspaceFactory
OpenFileDialog.FileName = ""
OpenFileDialog.Title = "生成数据库"
OpenFileDialog.Filter = "Access文件 (*.mdb)|*.mdb"
OpenFileDialog.ShowDialog()
If OpenFileDialog.FileName <> "" Then
TextBox1.Text = OpenFileDialog.FileName
End If
If Not OpenFileDialog.FileName = "" Then
'pWorkspaceFactory = New AccessWorkspaceFactory
'WorkSpace = pWorkspaceFactory.OpenFromFile(TextBox1.Text, 0)
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
SaveFileDialog.FileName = ""
SaveFileDialog.Title = "报表保存路径"
SaveFileDialog.Filter = "Excel 工作簿 (*.xls)|*.xls"
SaveFileDialog.ShowDialog()
If SaveFileDialog.FileName <> "" Then
TextBox2.Text = SaveFileDialog.FileName
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.Close()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim strsql As String
strsql = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & TextBox1.Text
Dim Conn As New OleDb.OleDbConnection(strsql)
Conn.Open()
Dim Cmd As OleDb.OleDbCommand
Cmd = New OleDb.OleDbCommand("select * from 123", Conn)
Dim dr As OleDb.OleDbDataReader
dr = Cmd.ExecuteReader
dr.Read()