Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Where to put the SQLServer CE database?

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
What we learned in Webroot's webinar on multi-vector protection.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

636 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