[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Where to put the SQLServer CE database?

Posted on 2010-09-15
1
Medium Priority
?
538 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
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
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

873 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