title: My database system cannot find the file specified in asp.net
body: <p>I am trying to retrieve data from a database with the following code:</p>
  
  <pre><code>public partial class populate : System.Web.UI.Page
  {
      SqlConnection scon = new SqlConnection("Data Source = localhost; Integrated Security = true; Initial Catalog = populate");  
  
      protected void Page_Load(object sender, EventArgs e) {     
          StringBuilder htmlString = new StringBuilder(); 
  
          if(!IsPostBack)
          {
              using (SqlCommand scmd = new SqlCommand())
              {
                  scmd.Connection = scon;
                  scmd.CommandType = CommandType.Text;
                  scmd.CommandText = "SELECT * FROM populate";
  
                  scon.Open();
  
                  SqlDataReader articleReader = scmd.ExecuteReader();
  
                  htmlString.Append("'Populate page:'");                
  
                  if (articleReader.HasRows)
                  {
                      while (articleReader.Read())
                      {
                          htmlString.Append(articleReader["dateTime"]);
                          htmlString.Append(articleReader["firstName"]);
                          htmlString.Append(articleReader["lastName"]);
                          htmlString.Append(articleReader["address"]);
                          htmlString.Append(articleReader["details"]);                       
                      }
                      populatePlaceHolder.Controls.Add(new Literal { Text = htmlString.ToString() });
                      articleReader.Close();
                      articleReader.Dispose();
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>It's throwing an error:</p>
  
  <blockquote>
    <p>The system cannot find the file specified</p>
  </blockquote>
  
  <p>I am wondering if someone can show me where the error is or guide me through debugging this. Thanks in advance.</p>
  
  <p>(update): More specifically, the scon.Open() is causing the error:</p>
  
  <p>Message=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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)</p>
  
  <p>This looks easy enough to fix, but I'm not very good with the database. Any help will be appreciated.</p>