Component to access sdf database table

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Component to access sdf database table

Post by NoComprende » Sat 28 May 2011 12:55

I've bought a piece of software that stores its database in an .sdf file which I've discovered is a MS SQL Server Compact Edition database. If I was to use the SDAC components how difficult would it be for me to access the tables within this .sdf file? I currently use the MyDAC components to access MySQL databases but, since I installed MySQL on the PC myself, I've no difficulty identifying the connection but I'd be totally lost as to filling in properties associated with this .sdf file. I know where the .sdf is located but that's about it.

AndreyZ

Post by AndreyZ » Mon 30 May 2011 08:49

Hello,

You can use the TMSConnection or TMSCompactConnection components to access the sdf file. Here are code examples:

Code: Select all

MSCompactConnection.Options.CompactVersion := cv35;
MSCompactConnection.Database := 'D:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Samples\northwind.sdf';
MSCompactConnection.LoginPrompt := False;
MSCompactConnection.Open;

Code: Select all

MSConnection.Options.Provider := prCompact;
MSConnection.ConnectString := 'Provider=MICROSOFT.SQLSERVER.MOBILE.OLEDB.3.5';
MSConnection.Database := 'D:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Samples\northwind.sdf';
MSConnection.LoginPrompt := False;
MSConnection.Open;
For more information, please read the "Working with SQL Server 2005 Compact Edition" article of the SDAC documentation.

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Mon 30 May 2011 11:11

Thanks AndreyZ.

I downloaded the components to test it but when trying to install them I get that message about being incompatible with existing components. From looking up the FAQ's I see it would mean I'd also have to update my MyDAC components to the latest version which would mean updating my subscription to them as well as paying for the ms components which I can't exactly afford at the moment.

AndreyZ

Post by AndreyZ » Mon 30 May 2011 12:54

Product compatibility is provided for the current build only. To make MyDAC and SDAC work simultaneously on the same IDE, you should use the latest versions of them. The latest compatible versions are the following: MyDAC 6.10.0.7, SDAC 5.10.0.6.
If you don't want to upgrade MyDAC, you can install SDAC on another computer where you don't have MyDAC, or temporary uninstall MyDAC. In both cases you will be able to test SDAC.

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Mon 30 May 2011 14:01

AndreyZ, if I uninstall MyDAC 5.9 then install SDAC would I then be able to reinstall MyDAC 5.9?

AndreyZ

Post by AndreyZ » Mon 30 May 2011 14:29

No, you cannot work with incompatible versions of MyDAC and SDAC simultaneuosly on the same IDE. As a temporary solution, you can download MyDAC trial version 6.10.0.7. This way you will be able to work with both MyDAC and SDAC (trial versions).

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Mon 30 May 2011 15:25

Thanks AndreyZ. The problem is, after I did the non-trial install, every time I needed to update the MyDAC components I'd also have to update the SDAC components and that would appear to be overkill when all I want to do is access a solitary .sdf file regularly.

Post Reply