Click here to Skip to main content
14,388,907 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am trying to import an excel sheet into sql server table. I have written the data access layer.

However I am unable to use Microsoft.Jet.OLEDB.4.0 and I want to use

This can be added as reference and imported to bin.

How to get the exact file path for the excel via command line.

any suggestion or code snippet pleasE?
Maciej Los 12-Nov-14 2:33am
Do not use JET.OLEDB.4.0 drivers! Use the newest one: ACE.OLEDB.xx.x!
Using Interop is not recommended.
Member 10562713 12-Nov-14 10:05am
Do you have any pointers to where I can enter a customer path for excel file and that uses the
Rate this:
Please Sign up or sign in to vote.

Solution 1

If you have to simply excel import to database then you can do the same
with Excel import utility of SQL Server without code.
Let me know if you have some specific purpose or any data manupulation or not.
Rate this:
Please Sign up or sign in to vote.

Solution 3

Two ways:
Solution 1 - programmatically:
1) to connect to the MS Excel workbook via ADO.NET (ACE.OLEDB)[^] using this connection string[^]
2) fetch data into datatable object
3) populate data into MS SQL server via SqlBulkCopy[^] (first you need to be connected to MS SQL server).

Solution 2 - manually:[^]
Member 10562713 14-Nov-14 1:19am
Any one written code that will insert excel file into sql table with out giving null exception using Microsoft.Office.Interop.excel???.
Rate this:
Please Sign up or sign in to vote.

Solution 2

The excel import utility is not useful for me here..I tried it before.
Im having date as a string in sql due to legacy transformation at the moment.
the date search dont work using sql import. This is by design for now.This cant be changed for a reason.

can someone point me hints in c# . please.
Maciej Los 12-Nov-14 10:31am
Not an answer. Please, delete it to avoid down-voting.
Use "Have a Question or Comment" widget instead.

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100