How to load data from Excel file to sql databse? - c#

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.

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.

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.

Related

Catia CATProduct & CATPart File Formats

I am trying to write a CatProduct/CatPart to step translator. I am writing this in c#. Just want to know if anybody knows what file format is a CatProduct or CatPart is saved in. The principal reason I want to read both file format is to establish the LASTSaveVersion contained within these files. Such information will allow me to translate using the correct Catia version of the CatBatchStarter dos utility. This windows application will ideally translate without entering the Catia modelling environment. This windows application will batch translate as well.
Any help much appreciated.

Reading from DBF files in C# without a driver

I'm currently writing a C# 4.5 desktop application intended to help troubleshoot an old VPF application. My app is intended to display a list of things that can commonly be broken along with their current status.
A few of the things I need to display are found in the VFP application's databases so I need to be able to read DBase databases. However, I have a few restrictions that make this tricky:
I can't guarantee that any DBF driver has been installed on the system.
My application should run without a separate installer so I can't just toss in the ACE redistributable. (I could install ACE together with the VFP app but I don't want to rely on any part of it being intact, even bundled libraries.)
Is there anything I can bundle with my app that can read VFP databases and doesn't require installation?
I wouldn't want to do this... but you could parse the files yourself.
It looks like someone on github has the same idea.
As Tom said,
You can parse DBF files yourself. Their structures are well documented.
As a side note, ACE has nothing to do with VFP database files and actually ACE cannot read/write DBF files (unless they are old DBF formats). Proper VFP database driver is VFPOLEDB which you can include its setup msi with your application. Using VFPOLEDB would be an easy path.

connect and read .MDB item with C# in UWP

I'm developing a UWP application and want to read a MDB file to convert this database to a SQLite database.
I read that i could use OleDbConnection to open MS Access database following this topic : connect and read .MDB item with C#
But OleDbConnection is not available in UWP project. It seems not available in System.data
Do you know solution to read MDB file in a UWP application programatically?
EDIT :
Microsoft team answered me this information :
Currently, there are no in-box API, or tools compliant third UWP
out-of-the-box that allows you to do that.
There is nothing in the roadmap for the moment regarding this point!
I propose you two tracks to explore:
Convert your .mdb file into sqlite "Ready to use".
Develop Web API that exposes the data of your mdb.
There's nothing in-box to do this. I'm not aware of any 3rd party libraries that understand .MDBs and supports UWP apps.
I'd convert the .MDB to SQLite from a non-UWP app and then have the UWP app deal only with SQLite.
It looks like there are many existing tools to do the conversion

SqlBulkCopy to upload Excel

If Im using SqlBulkCopy in .net 4.0 on a sql 2008 R2 database to upload excel data to the database, do I actually need Excel on the box hosting the site for this to work?
The reason I ask is I have a site up and running with this, and the hosting box has excel. The customer wants the site moved to a new box, this one doesnt have Excel and that bulk copy doesnt work. Other than the lack of excel there is no other difference.
thanks
If you are using the Microsoft Excel Object Library (COM Interop) to interface with Excel from .Net 4, then yes you need Excel installed as that is interfacing with the Excel object library.
What are your project references in C#?
Anything link to office automatiion would need taht part of office that is being automated. Also, if .Net 4 that objects may be referenced with the dynamic keyword.
Hard to tell exactly without knowing the project, references, and relevant code.
However, there are several third party libraries that allow interaction with Excel without having Excel installed. So, if you need to work without Excel, investigate using those.

Do I need to have Excel installed to query spreadsheets using an OleDB Provider?

I am working on some software that uses an OleDB to open a .xls file, query some data, and fill a dataset with the results. I am now looking at using this software on systems that do not have Excel. Will my software still be able to read the spreadsheets?
This xls file contains 1000s of configuration settings that my software uses. If this setup won't work on computers without Excel, I'm guessing my next best move is to convert the xls file to an XML file and read it in using XML Services.
You don't have to have office or the office data connectivity installed, you can use the Jet for OleDB engine which is installed on pretty much every windows machine in existence. However it's very old technology and is limited to 32 bit.
http://msdn.microsoft.com/en-us/library/ms175866.aspx
If you want to avoid this mess entirely then switch over to an app.config file or a properties file and you can get the pure .net solution.
You need either the full Office or the Office Data Connectivity Components installed on the client computers.

Categories

Resources