Page 1 of 1

Connection error with SQL Server Compact 4

Posted: Mon 02 Sep 2013 08:11
by atome
Hi,
I would like to connect to a SQL Compact 4 database using dbexpress driver in Delphi XE4.
When I try to open the connection this error occours:
'The database file cannot be open with the current version of SQL Server Compact Edition'.

If I use your test.sdf database all works.
The problem occours also if I open the connection in Delphi IDE. I think used driver is 3.5, bu I need version 4.
How can I open a version 4 sdf database from Ide and at runtime?

Thank you.

Re: Connection error with SQL Server Compact 4

Posted: Tue 03 Sep 2013 08:40
by AndreyZ
Hello,

Such error means that you are using not the correct SQL Server Compact client version to connect to a compact database. To connect to a compact database version 4, you should set the VendorLib connection parameter to sqlceoledb40.dll . Here is a code example:

Code: Select all

SQLConnection.Params.Values['VendorLib'] := 'sqlceoledb40.dll';

Re: Connection error with SQL Server Compact 4

Posted: Tue 03 Sep 2013 09:33
by atome
Hello,
thank you for your suggestion. It works great.

Alessandro

Re: Connection error with SQL Server Compact 4

Posted: Tue 03 Sep 2013 09:51
by AndreyZ
I am glad I could help. If any other questions come up, please contact us.