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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:18:30+00:00 2026-05-26T15:18:30+00:00

I have built a WP7.1 application that uses a local database. I used sqlmetal

  • 0

I have built a WP7.1 application that uses a local database. I used sqlmetal to generate the data context as per this article. http://blogs.microsoft.co.il/blogs/alex_golesh/archive/2011/05/24/windows-phone-mango-what-s-new-local-database-part-1-of-8.aspx

This works as expected using this in the ViewModel.

context = new BirdsnBflysDC(“DataSource=’isostore:BirdsnBflys.sdf'”);`

I am now attempting to “share” the Model and ViewModel code with a WPF application. Initially I added the appropriate files as a link to the WPF project. Creating an instance of the context didn’t work so as a test I have added just the data context code to a WPF project and attempt to create an instance of the context in the Loaded event handler as follows.

BirdsnBflysDC context = new BirdsnBflysDC(“DataSource=’C:\BirdsnBflys.sdf'”);
DataContext = context;

The code actually has the complete path to the database. When I step through this in the debugger the context initialization in the data context quits running as if there was an exception, the second line of code above is never reached and the WPF window is shown as if things completed correctly.

I’ve tried several variation in the DataSource string including “|DataDirectory|\\BirdsnBflys.sdf” all with the same result.

Any suggestions as where to go with this? How to figure out what isn’t working correctly?

Thanks,
Dave

  • 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-26T15:18:31+00:00Added an answer on May 26, 2026 at 3:18 pm

    The problem is that what is expected in the connection string is different for the two environments.

    WP7 works with this.

    context = new BirdsnBflysDC(“DataSource=’isostore:BirdsnBflys.sdf'”);

    WPF works with this.

    context = new BirdsnBflysDC(“|DataDirectory|\BirdsnBflys.sdf”);

    If you give WPF a file name that isn’t there you get no error information, the instantiation of the data context fails quietly and any additional code does not get executed.

    Dave

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

Sidebar

Related Questions

I have built an application that uses SQL Express 2005 and I want to
I have built a one page web application that manipulates a set of data:
I have built an application in C# that I would like to be optimized
I have built a MS Access 2007 application that can create reports files in
I have built a windows service application in VB.net 2008, and used the Setup
I have built an application that listen to call state changes, and I want
I have built an application in CakePHP that lists businesses. There are about 2000
I have built a shopping cart that uses Session State to keep the shopping
I have built an MSI that I would like to deploy, and update frequently.
I have built a .dll under WinXP that claims it can't find DWMAPI.DLL when

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.