1

I'm developping an application for Honeywell Dolphin 6100, a mobile computer with a barcode scanner that uses Windows CE 5.0 like OS.

I want to import data from excel file to the local database of the application. I'm following this tutoriel

The problem is that the System.Data.OleDb can not be found which is important to read data from an external file.

What I need to do ?

Note: I'm using VS2008 and I'm working on Windows 7.

Mohamed Jihed Jaouadi
  • 1,427
  • 4
  • 25
  • 44
  • do you have a using sttement for it: `using System.Data.OleDb;?` –  Apr 02 '13 at 14:09
  • in that link you posted the person has`using Excel=Microsoft.Office.Interop.Excel;` but to do this you only need `using System.Data.OleDb;` –  Apr 02 '13 at 14:10
  • yes I know, but unfortunately the relative line is underlined with a red line ; he can not found the librairy (the system.Data has only two children "common" and "sqlTypes"). – Mohamed Jihed Jaouadi Apr 02 '13 at 14:16
  • Do you have a reference to System.Data.dll in your project? i think if its a class library or something it might not have been added? –  Apr 02 '13 at 14:19
  • yes, the "System.Data.dll" exist in the list of the application librairies references !! – Mohamed Jihed Jaouadi Apr 02 '13 at 14:23
  • are you doing this form the CE project? if its one off task you could create a seperate console app to do this. or even better just use Access which will open excel and a DB and query both of them with sql (well access sql) –  Apr 02 '13 at 14:26

2 Answers2

2

You have a raft of hurdles to overcome. Just a few are

  • OLEDB is not supported under Windows CE.
  • Pocket Excel has no automation object model or even any published file format specification
  • Desktop libraries (like Microsoft.Office.Interop.Excel) will not work under Windows CE

Basically I think you're straying down a poor choice path.

What's the actual business problem you're trying to solve here? Do you have Pocket Excel files created on the device you need to merge into a local SQL Compact Database? Is there an option for not using Excel? Or is it that you have desktop Excel files on a PC and you want the data over on the device? If so, how are the files getting to the device? Can you convert them to CSV? Can you put a service on a server somewhere to do the conversion for you?

There's likely a way to solve the overall problem, just not on the path you're trying. We'd need to understand the actual problem to help you get a better solution, though.

ctacke
  • 66,480
  • 18
  • 94
  • 155
  • I want to use excel files in order to load data from it and insert the returned data into the local database to avoid the user from the long list of manual inputs (for example add list of users). Yes the excel files, like planned, will be in the machine by a normal transfert (connect the machine to a PC and insert files into a specific folder manualy). Actual it will be great if I can convert the excel file to .csv but I don't know if should I add this service into the server or make it one of the functionalities list of the application ? – Mohamed Jihed Jaouadi Apr 02 '13 at 14:43
  • 1
    Any work like that should be done where you have libraries and processing horsepower, so on the server. You could even push the data to an SDF on the server and just have the SDF file itself pushed to the device so all "import" work is already done. Why have a mobile processor doing work where it's slow and expensive when a server can do it faster and better. – ctacke Apr 02 '13 at 14:50
  • let's say that I will build an application for the convert operation, there's an easy way to convert an excel file to .csv file ? – Mohamed Jihed Jaouadi Apr 02 '13 at 16:53
  • 1
    Yes, on the desktop it's easy, but that's another question, so ask a new question to get an answer. – ctacke Apr 02 '13 at 17:10
  • OK, this is the question : [Question Link](http://stackoverflow.com/questions/15783667/how-to-convert-an-excel-file-to-csv-file) – Mohamed Jihed Jaouadi Apr 03 '13 at 09:32
0

some options:

  • write a one off console app to do the import.
  • use SQLserver management studio to do the one off import of an excel file
  • use microsoft access which will allow you to open the excel file and the DB and query across them both.

Unless you need to have your CE app accessing excel files all the time then maybe its not worth getting it to work just now.