Is it possible to access SqlCe from Windows app?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Want to access a SQLCe database from a Windows application. I set references
to the Compact Framework assemblies, but I'm having some issues because the
namespaces conflict with the regular .net Framework namespaces.

Anyone know how to do this??
 
Alex,

For a desktop app you should set references to the desktop SqlServerCe
assemblies and not the Compact Framework ones. The normal Add References
dialog in Visual Studio will find the right ones for you depending on which
type of app you're building.
 
Alex,
If you are not working with one of the VS languages (Delphi, VO etc) you can
use OleDB as well.
Just make an Adoconnection using this kind of connectionstring:
(not all properties are required)

Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data
Source=D:\cavo_apps28\Handhaving\Handhaving001.sdf;Mode=ReadWrite|Share Deny
None;SSCE:Max Buffer Size=640;SSCE:Database Password=Idonottell;SSCE:Encrypt
Database=False;SSCE:Default Lock Escalation=100;SSCE:Temp File
Directory="";SSCE:Default Lock Timeout=5000;SSCE:AutoShrink
Threshold=60;SSCE:Flush Interval=10;SSCE:Test Callback Pointer=0;SSCE:Max
Database Size=256;SSCE:Temp File Max Size=128

I use this in a VO application and it works like a charm.

In VO it will look like
LOCAL oconn AS Vo2AdoConnection
oconn := vo2AdoConnection{}
oconn:connectionstring := "Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;"+;
"Data Source=D:\cavo_apps28\Handhaving\Handhaving001.sdf;"
oconn:open(NIL,NIl, NIL)

hth
Erik


You can use the OleDB driver as well. Just make an Adoconnection using this
kind
 
Back
Top