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

  • Home
  • SEARCH
  • 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 9131737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:11:29+00:00 2026-06-17T08:11:29+00:00

I have a EntityModel created from ADO.NET that connects to my database. I want

  • 0

I have a EntityModel created from ADO.NET that connects to my database. I want to fill a DataGridview. For that I’m following this code:

using System.Data;
using System.Data.SqlServerCe;
using System.Windows.Forms;

namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
    InitializeComponent();
    FillData();
}

void FillData()
{
    // 1
    // Open connection
    using (SqlCeConnection c = new SqlCeConnection(
    Properties.Settings.Default.DataConnectionString))
    {
    c.Open();
    // 2
    // Create new DataAdapter
    using (SqlCeDataAdapter a = new SqlCeDataAdapter(
        "SELECT * FROM Animals", c))
    {
        // 3
        // Use DataAdapter to fill DataTable
        DataTable t = new DataTable();
        a.Fill(t);
        // 4
        // Render data onto the screen
        dataGridView1.DataSource = t;
    }
    }
}
}

This code comes from a Web Page, so I’m trying to adapt it to my ADO.NET model. So, as I’m not sure where the Properties.Settings.Default.DataConnectionStringcomes from, I thought it was the connection string used to connect to my database, so, following my Entity Model, I wrote this to get the connection string:

SqlCeConnection c = new SqlCeConnection(db.Connection.ConnectionString);

Where db is my Entity Model created like this:

private dbEntities db = new dbEntities();

But this db.Connection.ConnectionString returns this: “name= dbEntities”, so I changed it to db.Connection.DataSource, that returns this string:

"C:\\Users\\user\\Documents\\Visual Studio 2010\\Projects\\ProjectName\\MySQLProject\\bin\\Debug\\db.sdf" string

But it says that the string format is not adjusted (obviously…). I’m using SQL Server, but I’m not sure how to get that connection 🙁

The Properties.Settings.Default.DataConnectionString says this:

        Properties.Settings.Default.dbConnectionString  'System.Windows.Forms.PropertyStore' 

does not contain a definition for ‘Settings’ and no extension method ‘Settings’ accepting a first argument of type ‘System.Windows.Forms.PropertyStore’ could be found (are you missing a using directive or an assembly reference?)

  • 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-06-17T08:11:30+00:00Added an answer on June 17, 2026 at 8:11 am

    The message does not mean the connection string is in wrong format! Is says that there are no settings in your project.

    Are you sure that you created a respective setting? To edit them, double click the “Properties” entry in your project, then switch to the “Settings” tab. If there’s no entry dbConnectionString, create one.

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

Sidebar

Related Questions

Now that I have built a database. Visual Studio 2008 SP1’s ADO.NET Entity Framework
I have created a repository that is returning data from my database using Entity
I have generated entity model from my database which created entity classes. 1) Is
i have 3 tables in my database and i created a entity model from
I have created a new query like the following var pressData = from press
I have an OData WCF ADO.NET service created with Entity Framework using protocol version
I have created a new table in the membership database. Now I want to
I am stating out with entity framework. I have created my ADO.NET Entity Model
I have An EntityModel that is named ECommerceEntities that contains several entities. If I
I am working on asp.net application and I have generated entity model (edmx) from

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.