acido00 Posted September 13, 2007 Share Posted September 13, 2007 How Convert Excel Data to Access Database with .NET? I have a excel file with 8 columns... and my database in access use a table with 8 fields how can i convert the information from excel to access? Please help me! I'm using Visual Basic 2005 .Net thanks Link to comment https://www.neowin.net/forum/topic/587552-how-convert-excel-data-to-access-database-with-net/ Share on other sites More sharing options...
0 Josh Posted September 13, 2007 Share Posted September 13, 2007 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. Link to comment https://www.neowin.net/forum/topic/587552-how-convert-excel-data-to-access-database-with-net/#findComment-588847256 Share on other sites More sharing options...
0 acido00 Posted September 14, 2007 Author Share Posted September 14, 2007 wow with OleDB? can i use a excel file to show a grid in my windows form? where i can find a tuto? Link to comment https://www.neowin.net/forum/topic/587552-how-convert-excel-data-to-access-database-with-net/#findComment-588848494 Share on other sites More sharing options...
0 IceBreakerG Posted September 14, 2007 Share Posted September 14, 2007 (edited) 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 September 14, 2007 by IceBreakerG Link to comment https://www.neowin.net/forum/topic/587552-how-convert-excel-data-to-access-database-with-net/#findComment-588848552 Share on other sites More sharing options...
0 acido00 Posted September 14, 2007 Author Share Posted September 14, 2007 let me try Link to comment https://www.neowin.net/forum/topic/587552-how-convert-excel-data-to-access-database-with-net/#findComment-588848600 Share on other sites More sharing options...
0 acido00 Posted September 14, 2007 Author Share Posted September 14, 2007 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 Link to comment https://www.neowin.net/forum/topic/587552-how-convert-excel-data-to-access-database-with-net/#findComment-588848673 Share on other sites More sharing options...
0 Winston Posted September 15, 2007 Share Posted September 15, 2007 You need to assign the DataSet to the DataSource property of the DataGrid. Link to comment https://www.neowin.net/forum/topic/587552-how-convert-excel-data-to-access-database-with-net/#findComment-588849618 Share on other sites More sharing options...
Question
acido00
How Convert Excel Data to Access Database with .NET?
I have a excel file with 8 columns...
and my database in access use a table with 8 fields
how can i convert the information from excel to access?
Please help me!
I'm using Visual Basic 2005 .Net
thanks
Link to comment
https://www.neowin.net/forum/topic/587552-how-convert-excel-data-to-access-database-with-net/Share on other sites
6 answers to this question
Recommended Posts