Connection error with SQL Server Compact 4

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
atome
Posts: 5
Joined: Mon 02 Sep 2013 08:02

Connection error with SQL Server Compact 4

Post by atome » Mon 02 Sep 2013 08:11

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.

AndreyZ

Re: Connection error with SQL Server Compact 4

Post by AndreyZ » Tue 03 Sep 2013 08:40

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';

atome
Posts: 5
Joined: Mon 02 Sep 2013 08:02

Re: Connection error with SQL Server Compact 4

Post by atome » Tue 03 Sep 2013 09:33

Hello,
thank you for your suggestion. It works great.

Alessandro

AndreyZ

Re: Connection error with SQL Server Compact 4

Post by AndreyZ » Tue 03 Sep 2013 09:51

I am glad I could help. If any other questions come up, please contact us.

Post Reply