title: C# Invalid object name ASP.NET
body: <p>I'm trying to retrieve records to my data gridview <code>dgvEmployees</code> from my table <code>tblEmployees</code>. I'm not sure what's wrong though, maybe because of the syntax? But the code has worked before using MS Visual C# 2010 Express (WinForms only). I'm currently creating a webpage with winforms using MS Visual Studio (ASP.NET - C#). Here's my code:</p>
  
  <pre><code>    SqlConnection sConn;
      SqlDataAdapter daEmp;
      DataSet dsEmp;
  
      const string sStr = "Server = MYSERVER\\SQLEXPRESS; Database = EMPLOYEES; Integrated Security = SSPI";
  
      protected void Page_Load(object sender, EventArgs e)
      {
          sConn = new SqlConnection(sStr);
          daEmp = new SqlDataAdapter("Select * from tblEmployees", sConn);
          dsEmp = new DataSet();
  
          daEmp.Fill(dsEmp, "tblEmployees");
  
          dsEmp.Tables["tblEmployees"].PrimaryKey = new DataColumn[] { dsEmp.Tables["tblEmployees"].Columns["EmployeeID"] };
  
          dgvEmployees.DataSource = dsEmp.Tables["tblEmployees"];
  
      }
  </code></pre>
  
  <p>Here's the error message on this line <code>(daEmp.Fill(dsEmp, "tblEmployees");</code></p>
  
  <pre><code>Invalid object name 'tblEmployees'
  </code></pre>
  
  <p>Please help. Thanks!</p>