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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:43:39+00:00 2026-06-17T04:43:39+00:00

On Visual Studio 2010, I have a database that I’m trying to connect to,

  • 0

On Visual Studio 2010, I have a database that I’m trying to connect to, but when I try to do:

db.Open();

It launches this mistake:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)

I tried to do what this link says, but I still keep having the same mistake.

Any ideas on what’s going on?

EDIT: Firewall is OFF.

Connection String: MySQLProject.Properties.Settings.Default.dbConnectionString = “Data Source=|DataDirectory|\db.sdf”

Server is up:

enter image description here

EDIT2:

This is the code that fails:

public void FillData()
    {
        // 1 step. Open connection
        // SqlConnection c = new SqlConnection("Data Source=" +db.Connection.DataSource);
        SqlConnection c = new SqlConnection(MySQLProject.Properties.Settings.Default.dbConnectionString);
        try
        {
            c.Open();

            // 2 step. Create new DataAdapter
            using (SqlDataAdapter a = new SqlDataAdapter("SELECT * FROM USER", c))
            {
                // 3 step. Use DataAdapter to fill table
                DataTable t = new DataTable();
                a.Fill(t);
                // 4 step. Render data on the DataGridView
                dataGridViewUsers.DataSource = t;
            }
        }
        catch (SqlException e)
        {
            MessageBox.Show(e.Message);
        }
    }

EDIT nº 1000:

Ok, I used this connection string:

string con2 = @"Server=.\SQLExpress;AttachDbFilename=|DataDirectory|db.sdf;Database=db;Trusted_Connection=Yes;";

And then it says this:

enter image description here

:____(

Ok, now i Know that .sdf is for CE Sql statements. But, I can’t create .mdf, don’t know exactly why… Should I change to CE Sql statements?

  • 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-17T04:43:40+00:00Added an answer on June 17, 2026 at 4:43 am

    The most typical reasons are:

    • The server is not runing
    • Connection string has typo (some letters are wrong)

    So when connecting to not existing or shuted down server, this message appears

    EDIT: please try to check this: SQL Server Express connection string for Entity Framework Code First, because it seems, that your conn string is not complete:

    connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
                           AttachDBFilename=|DataDirectory|aspnetdb.sdf;
                           User Instance=true"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I notice that Visual Studio 2010 database projects have a re-distributable component to support
I have a database project in Visual Studio 2010 that deploys tables and stored
I have an SQL 2008 database project in Visual Studio 2010 that is sync'ed
I have created SQL Server database by Visual Studio 2010 Ultimate means in Visual
I have created SQL Server 2008 Database project using visual studio 2010. after build
I have saved an image path in database like so: C:\Users\3embed\Documents\Visual Studio 2010\Projects\HeritageWeb\HeritageWeb\Images\startbutton.png I
In my Visual Studio 2010 project I have files with .mm file extension, that
Visual Studio 2010 RC -> Silverlight Application We have a library of images that
I have a Visual Studio 2010 solution that contains a class library (ProjectA) and
We have developers using Visual Studio 2010 professional and some trying out Visual Studio

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.