Page 1 of 1

Component to access sdf database table

Posted: Sat 28 May 2011 12:55
by NoComprende
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.

Posted: Mon 30 May 2011 08:49
by AndreyZ
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.

Posted: Mon 30 May 2011 11:11
by NoComprende
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.

Posted: Mon 30 May 2011 12:54
by AndreyZ
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.

Posted: Mon 30 May 2011 14:01
by NoComprende
AndreyZ, if I uninstall MyDAC 5.9 then install SDAC would I then be able to reinstall MyDAC 5.9?

Posted: Mon 30 May 2011 14:29
by AndreyZ
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).

Posted: Mon 30 May 2011 15:25
by NoComprende
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.