views:

766

answers:

3

I have a mobile app that writes to a SQL Server CE database on the device. I want to write a desktop application that can read this data and export it in CSV format. I have been looking at RAPI (Remote Api), but I would prefer to do this entirely with managed code. Is there an alternative to RAPI?

A: 

You could write a custom socket communication protocol, so your mobile app would listen for a socket connection and the desktop would "call in" and then send commands.

ctacke
I don't want to talk to an application on the phone, I want to be able to move date off the device when it is connected to the desktop. The SQL Server CE database is a single file that I can read and copy to the local disk with RAPI.
cdonner
I disagree. You *do* want to talk to an app on the phone. How else would you get data from it? RAPI talks to the ActiveSync app on the phone. Something has to be there to listen for a command, query the data, and ship it back to the PC. Whether it's a file or a record, the porocess is the same.
ctacke
Yes, you are correct, technically. So, to reword my comment, I did not want to write a custom application in order to do something that might be there already. I ended up using RAPI and it works like a charm.
cdonner
A: 

The reason why I asked this question initially was my concern that RAPI was going to be too involved for my little app (after looking at the API docs). I started out writing a wrapper library in unmanaged code nontheless, only to realize that I would have to carry the entire C++ runtime environment along. So I ended up cobbling together a few methods for RAPI file handling and file system operations that call RAPI directly from C# using P/Invoke. I found a few of these methods in various places, added some more of my own, and put them all in a C# class. I fitted them with consistent error handling, and it turned out to do exactly what I needed, after only a few hours of effort.

cdonner
+1  A: 

Did you use RAPI to copy the SQLCE database over to the PC and let the PC app work with it and when it was done, copied the database file back to the PDA?

I was thinking of doing something similar.

Please let me know if you faced any roadblocks/issues in the way.

Did you use OpenNETCF 2.3?

CF_Maintainer
I used RAPI directly. I only needed a handful of function calls. It is working just fine. This is the app:http://cdonner.com/free-mileage-tracker-for-windows-mobile-6-smartphones.htm
cdonner