Click here to Skip to main content
15,793,442 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends , i have a requirement in winforms, i will import the excel sheet or open office file into access database. i was wrote the code in excel to access database. if excel is not there and open office is there in client system . any one of the file will import the file into access database. Here access database fields names and open office or excel sheet field names should same and any version should work using our code.
Dim connect As String = _
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + _
Excel + ";Extended Properties=""Excel 12.0 Xml;"""

Using conn As New OleDb.OleDbConnection(connect)

    Using cmd As New OleDbCommand()

        cmd.Connection = conn

        'inserting the Excel data to Access database
        cmd.CommandText = "INSERT INTO [MS Access;Database=" & _
           Access & "].[village] SELECT * FROM [" + tableName + "$]"



    End Using

End Using

Please help me anyone.
advanced thanks...
Updated 25-Jul-13 6:12am

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900