• 0

How Convert Excel Data to Access Database with .NET?


Question

6 answers to this question

Recommended Posts

  • 0

You can just use the Excel file itself, depending on the nature of what you want to do with the data in it, using OleDb

http://support.microsoft.com/kb/311731

Or you can import that data using an access tool built into the application unless I'm mistaken.

  • 0

Check out this thread:

http://www.thescripts.com/forum/thread704418.html

This is another page on how to create an Excel file:

http://www.vbdotnetheaven.com/UploadFile/g...preadsheet.aspx

Also, here's a short snippet of code I found on another forum:

Dim cnn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mailmerge.xls;Extended Properties=""Excel 8.0;HDR=YES;""")

Dim oDA As New OleDb.OleDbDataAdapter("Select * from [Sheet1$]", cnn)

oDs = New DataSet("TestExcel")
oDA.Fill(oDs)

Edited by IceBreakerG
  • 0

how fill a datagrid with this code?

'first specify the path and filename of your excel
Dim PathFilename As String = "C:\TESTME.xls"
'second is specify the sheet name you want to read
Dim strSheetName As String = "Sheet1"

'create a connection
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim DS As System.Data.DataSet
Dim _sqlqry As String
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0amp; _
"data source='" & PathFilename & " '; " & "Extended Properties=Excel 8.0;")
'Select the data from Sheet1 of the workbook.
MyCommand = New System.Data.OleDb.OleDbDataAdapter("selectom [" & strSheetName & "$]", MyConnection)
DS = New System.Data.DataSet
MyCommand.Fill(DS)
MyConnection.Close()
MyConnection.Dispose()
MyConnection = Nothing

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.