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 7693111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:00:35+00:00 2026-05-31T21:00:35+00:00

I created a local db with helper app project. and deployed it from isolate

  • 0

I created a local db with helper app project. and deployed it from isolate storage to installation folder,i added to project directory with content build action by add existing item. my problem is that i want to insert data, but i don’t know how to move the db file to isolate storage to insert and data must add to my .sdf file that is locate in my project directory also.

  • 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-31T21:00:36+00:00Added an answer on May 31, 2026 at 9:00 pm

    Souphia,
    While learning to use WP, I wrote a simple application that tracked tasks.
    One version of that app stored all task data in Sql on the phone.
    You can read the post and download all the code for the app here:

    http://www.ritzcovan.com/2012/02/building-a-simple-windows-phone-app-part-3/

    But, here is some of the code from that project:

    First we have the model class decorated with the appropriate attributes:

    [Table]
    public class Task : INotifyPropertyChanged, INotifyPropertyChanging
    {
        [Column(IsDbGenerated = false, IsPrimaryKey = true, CanBeNull = false)]
        public string Id
        {
            get { return _id; }
            set
            {
                NotifyPropertyChanging("Id");
                _id = value;
                NotifyPropertyChanging("Id");
            }
        }
    
        [Column]
        public string Name
        {
            get { return _name; }
            set
            {
                NotifyPropertyChanging("Name");
                _name = value;
                NotifyPropertyChanged("Name");
            }
        }
    
        [Column]
        public string Category
        {
            get { return _category; }
            set
            {
                NotifyPropertyChanging("Category");
                _category = value;
                NotifyPropertyChanged("Category");
            }
        }
    
        [Column]
        public DateTime? DueDate
        {
            get { return _dueDate; }
            set
            {
                NotifyPropertyChanging("DueDate");
                _dueDate = value;
                NotifyPropertyChanged("DueDate");
            }
        }
    
        [Column]
        public DateTime? CreateDate
        {
            get { return _createDate; }
            set
            {
                NotifyPropertyChanging("CreateDate");
                _createDate = value;
                NotifyPropertyChanged("CreateDate");
            }
        }
    
        [Column]
        public bool IsComplete
        {
            get { return _isComplete; }
            set
            {
                NotifyPropertyChanging("IsComplete");
                _isComplete = value;
                NotifyPropertyChanged("IsComplete");
            }
        }
    
        [Column(IsVersion = true)] private Binary _version;
    
        private string _id;
        private bool _isComplete;
        private DateTime? _createDate;
        private DateTime? _dueDate;
        private string _name;
        private string _category;
        public event PropertyChangedEventHandler PropertyChanged;
        public event PropertyChangingEventHandler PropertyChanging;
    
        public void NotifyPropertyChanged(string property)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(property));
        }
    
        public void NotifyPropertyChanging(string property)
        {
            if (PropertyChanging != null)
                PropertyChanging(this, new PropertyChangingEventArgs(property));
        }
    }
    

    In the constructor in app.xaml.cs, I have the following:

     TaskMasterDataContext = new  TaskMasterDataContext();
    
     if (!TaskMasterDataContext.DatabaseExists())
     {
        TaskMasterDataContext.CreateDatabase();
        DatabaseHelper.SetupDatabase(TaskMasterDataContext);
     }
    

    and here is the TaskMasterDataContext.cs code

     public class TaskMasterDataContext : DataContext
        {
            public TaskMasterDataContext() : base("Data Source=isostore:/TaskMasterData.sdf")
            {
            }
            public Table<Task> Tasks;
        }
    
    
        public static class DatabaseHelper
        {
            public static void SetupDatabase(TaskMasterDataContext dataContext)
            {
                string category = string.Empty;
                var tasks = new List<Task>();
                for (int i = 0; i < 20; i++)
                {
                    tasks.Add(new Task()
                                  {
                                      Id = System.Guid.NewGuid().ToString(),
                                      Category = GetCategoryString(i),
                                      CreateDate = DateTime.Now,
                                      DueDate = DateTime.Now.AddDays(new Random().Next(1, 30)),
                                      IsComplete = false,
                                      Name = String.Format("{0} Task # {1}", GetCategoryString(i), i)
                                  });
                }
                dataContext.Tasks.InsertAllOnSubmit(tasks);
                dataContext.SubmitChanges();
            }
    
            private static string GetCategoryString(int i)
            {
                if (i%2 == 0)
                    return "home";
    
                if (i%3 == 0)
                    return "personal";
    
                return "work";
            }
        }
    

    The DatabaseHelper class is just there to populate the DB with some test data after its created.
    I hope this helps.

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

Sidebar

Related Questions

For a new project I have created a local folder tree with empty Visual
I've created a page that saves a form to local storage as JSON. It
I created a set up project and installed a web application on my local
In app/controllers/admin I created dashboad_controller.rb: class Admin::DashboardController < ApplicationController def index end end From
I created a local Git repo on my laptop and then pushed the source
How can I shift timezone of Date object created in local timezone to target
I created a branch on my local Mercurial repository. I want to push to
I successfully created database on my local server using Code First, migrated it to
So I have a local SQLite table breadcrumbs being created on the Android device.
I have a local branch work, where I created two new files a.py, b.py

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.