I have an SQL Express file with a single table People. People has six or seven columns, but no rows. The database is a resource in my Visual Studio 2010 Express project. I am trying to connect with this code:
SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS; AttachDbFilename=C:\\someLocation\\someDatabase.mdf; Integrated Security=True; User Instance=True ");
conn.Open();
SqlCommand cmd = new SqlCommand(@"select * from People;", conn);
However, I am getting the following error:
Invalid object name 'People'.
Based on some casual googling I tried to precede the table name with dbo (dbo.People) but that did not resolve the issue. What might I be doing wrong?
EDIT: Here is a screenshot of Visual Studio showing the database, it’s structure and content, and its presence in the Solution Explorer:

Please try this query instead and tell us if you see a table with the name People:
C# Code example: