Invalid object name 'aspnet_Membership'
I use visual studio and c# win forms (web forms). I try open connection to MS 2005 Server and reader query.here - is
sql = "SELECT Files.ID, Files.FileName, Files.File_Name, Files.CreatingDate, aspnet_Users.UserName, aspnet_Membership.Email "
+ "FROM aspnet_Membership "
+ "INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId "
+ "INNER JOIN Files ON aspnet_Membership.UserId = Files.UserId";
And those tables exists in databes. Invalid object name 'aspnet_Me开发者_开发百科mbership'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'aspnet_Membership'.
Source Error:
Line 47: SqlCommand cmd = new SqlCommand(sql, con);
Line 48: con.Open();
Line 49: SqlDataReader reader = cmd.ExecuteReader();
Line 50: string str = "";
I am frustrated. Thanks in advance
The table aspnet_Membership either doesn't exist or is inaccessible. Use SQL Server Management Studio to figure out if it exists. It might also be that you're connecting to the wrong database. Double check your connection string
精彩评论