Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6761123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:08:54+00:00 2026-05-26T14:08:54+00:00

Install SQL Server CE database in a separate folder, and application in other folder

  • 0

Install SQL Server CE database in a separate folder, and application in other folder as usual. While uninstalling application from device, database won’t delete. When reinstalling application on the same device, check if database exist in it [where we saved on first install], if not exist save in common folder for all smart devices [like \Program Files\], else use existing DB .

How can I do this using C#, Windows Mobile 6?????

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:08:55+00:00Added an answer on May 26, 2026 at 2:08 pm

    After reading your comment, I’d suggest something similar to the following:

    • When your application starts, have it check for the existence of your database at the path you require (or at a path specified in an INI file)

    • If the database is not found, ask the user if the default database should be used (or, just copy it over if they should have no choice).

    When the application is removed, this database will remain.

    When your application is reinstalled, it can use the database that was left.

    Example:

    namespace DBTest1 {
    
      public partial class Form1 : Form {
    
      const readonly string MYDATABASE = "\\Application Data\\DBTest1\\sqlce.db";
    
      private void Form1() {
        InitializeComponent();
        CreateIfNotThere(DBTest1.Properties.Resources.sqlcedb, MYDATABASE);
      }
    
      void CreateIfNotThere(object data, string filename) {
        if (String.IsNullOrEmpty(filename)) {
          filename = string.Format(@"{0}{1}{2}",
          Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
          Path.DirectorySeparatorChar, "sqlCe.db");
        }
        if (data != null) {
          byte[] array = (byte[])data;
          FileInfo file = new FileInfo(filename);
          if (!file.Exists) {
            using (FileStream fs = file.Create()) {
              fs.Write(array, 0, array.Length);
            }
          }
        }
      }
      // other code
    }
    

    If you want to get into writing custom CABWIZ steps, there is a nice write up in the How to create the inf file for a smart device cab project from command line? thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to re-install SQL Server Express from http://www.microsoft.com/express/Database/ . Visual Studio Web was
We have an application that installs SQL Server Express from the command line and
I have developed a Windows application in .NET which uses a SQL Server database
I am creating a window application that need to use sql server database. I
I am using a C# application and connection to database using sql server 2008
If I make an SQL server database, 1) Do I need to install SQL
I want to install an application (ASP.Net + SQL server 2005 express) in local
I have an application with a SQL Server CE private install. We want to
I'm trying to install SQL Server 2005 Express SP3 on two of my machines.
Is it possible to install sql server 2005 express and sql server 2008 developer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.