Solved

Opening .SDF files with SQL Server Express - C#

Posted on 2007-11-30
2
11,533 Views
Last Modified: 2013-12-16
Hi Guys,
I'm trying to open a .SDF datadase file. The file was previously created on a PDA and subsequently transfered to my laptop where I have SQL Server Express installed.

In the application on my laptop, I define the SQL connection like this:
    String FileName="C:\\Datafolder\\MyDataFile.sdf";
    ShiftFileConnection = new SqlConnection("server=SCAMLT001\\SQLEXPRESS;"
                                                                     + "Trusted_Connection=yes;"
                                                                     + "data Source=" + FileName);
   ShiftFileConnection.Open();

When I call the .Open() method, an exception occurs with the following error message:
"An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

I suspect I just haven't got the connect string quite right, but I've tried numerious connect strings without any success.   - Can someone kindly review my connect string and point out the error.   -Thanks
0
Comment
Question by:GavinS
2 Comments
 
LVL 25

Accepted Solution

by:
imitchie earned 250 total points
ID: 20386611
SQL Server express cannot open .SDF files, which are for SQL Server CE. You need to use the SQL CE libraries to open them instead.
0
 

Author Closing Comment

by:GavinS
ID: 31623403
Thanks imitchie:
That fixed it. I didn't think the SQLce libraries would work for conventional windows applications.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now