?
Solved

Where to put the SQLServer CE database?

Posted on 2010-09-15
1
Medium Priority
?
534 Views
Last Modified: 2012-05-10
I decided I needed to keep the database in only one location, since it was driving me nuts to have different copies of it around depending on whether I was in Debug mode or Design mode.   But I wanted to take advantage of the |DataDirectory| macro so I run the code attached on start up and I copied the database to that location....

My question is, does it make sense to put it at that location or is there a better approach?

I am interested in hearing your responses.

Thanks for your help.
Public Function SetDataString(ByRef lex As LastException) As Boolean
        ConnString = Application.CommonAppDataPath
        System.AppDomain.CurrentDomain.SetData("DataDirectory", ConnString)
        Return True
    End Function

Open in new window

0
Comment
Question by:codefinger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 51

Accepted Solution

by:
Mark Wills earned 2000 total points
ID: 33690430
Yeah - it can be frustrating to see / have that copy in the debug folder, but if it is part of your project then it will do that. Is this for mobile apps, or are you using the compact / CE database in other clients ?

As you say, you can create/customise your own connection string - have a look at Steve Lasker's code (an oldie but still good): http://blogs.msdn.com/b/smartclientdata/archive/2005/07/25/443034.aspx

For a general discussion about using the datadirectory macro, have a read of : http://blogs.msdn.com/b/smartclientdata/archive/2005/08/26/456886.aspx

There is also some good general information in msdn : http://msdn.microsoft.com/en-us/library/aa983341.aspx and look at that "local data" link : http://msdn.microsoft.com/en-us/library/ms233817.aspx it has some good walkthroughs and suggestions.

For us, we simply decided a most appropriate location for us, and used the approach per Steve's posting. We "bundled" our app in such a way that using a custom connection string meant that we always knew (also from a support perspective) exactly where the data was and how to get there... And that is kinda what the datadirectory achieves, so, looking back would have been a good choice, but, for some of our deployments (on mobile devices) we also had the app and data running from the sd card, so had to "roll our own" standards into our connection (and deployment).




0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 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