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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:51:48+00:00 2026-05-23T17:51:48+00:00

I have created a windows form application: A presentation library with several windows forms

  • 0

I have created a windows form application:

  1. A presentation library with several windows forms
  2. A class library with a data layer
  3. A class library to access a database

I’m using EntityFramework 4.1 with Code First Approach and SQL Compact 4.0 database.

I created a connection string in the app.config file in the class library project used to connect to the database. The problem is that the connection string has apparently no influence on the database creation. I mean that everything is working fine with the program but even if I specify a location for the database this does not have any effect!

Am I writing in the right app.config?
Do I need to initialize my DbContext class in a specific way? (today I do not pass any connection string in the constructor)

DbContext class:

public class MyDB : DbContext
{
    public DbSet<ContactPerson> ContactPersons { get; set; }

    public DbSet<Customer> Customers { get; set; }

    public DbSet<Project> Projects { get; set; }

    public DbSet<Quotation> Quotations { get; set; }

    public MyDB()
    : base("MyDatabase")
    {

    }
}

App.config connection string:

<add name="MyDatabase" connectionString="Data Source=MyDB.sdf" 
providerName="System.Data.SqlServerCE.4.0">
  • 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-23T17:51:49+00:00Added an answer on May 23, 2026 at 5:51 pm

    You need to put the app.config in the application (.exe) project. The app.config file should look like in this blog post (case sensitive): http://erikej.blogspot.com/2011/04/saving-images-to-sql-server-compact.html and the names should be MyDB, not MyDatabase…

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

Sidebar

Related Questions

Im using c# .net windows form application. I have created a database which has
I have created a Windows Form Application using Visual C# 2008 Express Edition with
Im using c# .net windows application form. I have created many databases with many
Im using c# .net windows form application. I have many databases created using sql
I have a static library *.lib created using MSVC on windows. The size of
I have created an msi to install my Windows form application and when i
I have a simple Windows Form application that is using the .net 3.5 compact
Is it possible to create a form on Windows using Ruby? I have a
I have created a windows installer for a windows forms app as an MSI.
I have created an installation package using Wix which installs a Windows service on

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.