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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:56:17+00:00 2026-05-28T03:56:17+00:00

I am trying to use SQL Server CE on Windows Phone Mango. Here is

  • 0

I am trying to use SQL Server CE on Windows Phone Mango. Here is my DataContext:

public class FooDataContext : DataContext
{
    private static readonly string DB_CONNECTION_STRING = "Data Source=isostore:/foo.sdf";

    // Pass the connection string to the base class.
    public FooDataContext() : base(DB_CONNECTION_STRING)
    { }

    // can this be a property?
    public Table<Foo> Items;

    public void ClearDatabase()
    {
        if (DatabaseExists())
        {
            DeleteDatabase();
        }
    }

    public void EnsureDatabaseExists()
    {
        if (!DatabaseExists())
        {
            CreateDatabase();
            SubmitChanges();
        }
    }
}

In the constructor of the main page, I call EnsureDatabaseExists(). If I’ve changed the schema, I also include a call to ClearDatabase():

//fooData.ClearDatabase();
fooData.EnsureDatabaseExists();

Foo‘s columns are int, double, and DateTime. When I run the app without the ClearDatabase() call, I get the following error as soon as I try to access fooContext.Items:

The specified table does not exist. [ Foo ]

What is going on here? If I freshly install the app, everything works fine.

  • 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-28T03:56:18+00:00Added an answer on May 28, 2026 at 3:56 am

    The backing table structures for a Linq To SQL DataContext are only created when CreateDatabase() is called, or when you explicitly update the schema through the DatabaseSchemaUpdater.Execute() method.

    I suspect what is happening in your case, is that you are adding a new entity type to your data model, however you are not actually updating the schema via DatabaseSchemaUpdater. This results in Linq To SQL generating a query which references a table which has not yet been created within the database engine.

    I would recommend that you check out the DatabaseSchemaUpdater class if you want to be able to handle schema changes in your application.

    http://msdn.microsoft.com/en-us/library/hh133477(v=VS.95).aspx

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

Sidebar

Related Questions

I'm trying to use sqlcmd on a windows machine running SQL Server 2005 to
I'm trying to use SQL Server 2000 DTS Package to download a file from
I'm trying to use SQL Server Profiler (2005) to track down some application performance
I am trying to use a SQL Server 2008 Ranking Function on a query
I'm using SQL Server 2008 (non-R2) and trying to use Report Builder 3.0. When
I am trying to use an update trigger in SQL Server 2000 so that
I am trying to use WCF Services as models for SQL Server Reporting Services
I'm trying to learn advanced sql and how to use system queries (sql server).
i have a sql server that i use and i am trying to code
I'm trying to use the SQL Server bcp utility to import a text file

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.