Tuesday, December 27, 2005

One application, two database engines

I have just figured out how to enable the same application to consume either SQL CE 2.0 or SQL Mobile databases at run time. I'm obviously talking about OLE DB here.

When Microsoft shipped SQL Mobile, we got a new header file to include in our applications: ssceoledb30.h. Unfortunately, this means that you cannot have both the old include file and the new include file on the same exe. You can use the preprocessor to include either one, but this is not what I was looking for: I wanted an integrated solution that would allow me to consume any database (2.0 or 3.0) from the very same exe.

The solution is to merge both header files into just one. While I wait for Microsoft to tell me if I can publish the one I wrote (due to copyright issues, of course) you can have a go at it yourself by diff'ing the two files and figuring out the differences. Not many, actually.

4 comments:

FP said...
This comment has been removed by a blog administrator.
FP said...
This comment has been removed by a blog administrator.
FP said...
This comment has been removed by a blog administrator.
FP said...

actually you could use the old oledb header - only add device SQL_SERVER_CE_30 GUIDs. most functionality will work.