Export Data from Access to Excel file in VB .Net 2003

  • Thread starter Thread starter Alice
  • Start date Start date
A

Alice

Does anybody knows how to do the above mentioned?

Please see below for the codes used for VB.
I need codes for VB .Net 03 doing the same thing.
TIA for any help.

strSQL = "SELECT Product_Master.* " & _
"INTO [Excel 8.0;DATABASE=C:\PDT_MAS.XLS].[PDT_MAS] " & _
"FROM Product_Master; "
Database1.Execute strSQL
 
Something like this:

Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\MySource.xls;" & _
"Extended Properties=Excel 8.0;"
Dim Conn As New System.Data.OleDb.OleDbConnection(ConnectionString)
Conn.Open()
Dim Sql As String = "SELECT Product_Master.* " & _
"INTO [Excel 8.0;DATABASE=C:\PDT_MAS.XLS].[PDT_MAS] " & _
"FROM Product_Master; "
Dim Comm As New System.Data.OleDb.OleDbCommand(Sql)
Comm.Connection = Conn
Comm.ExecuteNonQuery()
 
Back
Top