Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to instantiate a sqlserverCe engine? 1

Status
Not open for further replies.

mplaza

Programmer
Nov 23, 2009
135
VE
Hi, I'm developing an application using sqlserver ce. The oledb part works fine, but I want to implement the DB maintenance routines, wich are only exposed through ssce.engine. Does anybody know how to use ssce.engine / ssce.error etc from vfp? I'been able to explore the dll with the object browser, and it implements idispatch and Iunknown interfaces ( see attached file ) But CreateObject('ssce.engine.4.0') throws 'OLE error code 0x80004002:Unknown com status code'.
In other thread I saw a sqlite example using vfp2c32 for the implementation..( saying it needs a callback object ) is this the same case? the help file code for c++ is here:


I'll appreciate your advice.

Marco
 
The link provided goes into Ce 3.5 documentation.
I don'T know, but there seems to be something else needs to be implemented besides IDispatch for foxpro to be able to instanciate.

If CreateObject fails you can always try out CreateObjectEx:

Code:
o = CreateObjectEx('ssce.engine.4.0','','')

The cIID parameter (third parameter) seems to be the key. If you omit it, you get the same error as with CreateObject(). Help says, if you specify an empty stting, it attempts to access the default interface.

From this the only logic conclusion, though not sounding logic, is: If you omit the parameter or use CreateObject(), foxpro by default does not access the default interface.

I haven't tried further, but intellisense exposes engine methods.

Bye, Olaf.
 
Glad to meet you Olaf, thanks for answering. I already tryed createobjectex( ) passing the clsid and iid's found on the registry with same error. I give up. It seems that there's no direct/easy way of doing it from vb/vfox, so it seems that com interop will be easier... Thanks again.

Marco
 
For me this works(!)

Perhaps try reinstalling and install the x86 Version, even on a 64bit server or client, foxpro can only work with 32bit drivers and OLE classes.

Bye, Olaf.
 
Sooner or later it happens.. I was passing a null parameter, not empty string..

the command line of shame..:

o=CREATEOBJECTEX('ssce.engine.3.5',,)

even used vfp2c32 and searched for the iid on registry..

o=CREATEOBJECTEX(clsidfromprogid('ssce.engine.3.5'),,)
o=CREATEOBJECTEX(clsidfromprogid('ssce.engine.3.5'),,'{10EC3E45-0870-4D7B-9A2D-F4F81B6B7FA2}')
o=CREATEOBJECTEX('{a9d3060d-3526-4538-b13a-1913568daa0d}',,'{10EC3E45-0870-4D7B-9A2D-F4F81B6B7FA2}')

Thanks a lot...

Marco
 
The cIID parameter (third parameter) seems to be the key. If you omit it, you get the same error as with CreateObject(). Help says, if you specify an empty stting, it attempts to access the default interface.
stting = string of course.

Yes, reading helps.

Anywy, lad you figured it out.

Bye, Olaf.
 
Oh, and don't take this too serious. The main interest for me is to help get things going.

I'm perhaps a bit disilllusioned from time to time, and get a bit grumpy, especially if people see code in an answer and simply take it for granted not caring about accompanying text, which is obviously NOT what you did - else you would have seen the code works as given.

So you were actually reading more than just the code snippet...

Feel welcome here, even if you have more questions on SQL CE in conjunction wit VFP. I also learned about the engine OLE class here and so it was already an exchange of experience and knowledge.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top