开发者

Invalid object name 'aspnet_Membership'

开发者 https://www.devze.com 2023-02-10 04:15 出处:网络
I use visual studio and c# win forms (web forms). I try open connection to MS 2005 Server and reader query.here - is

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

0

精彩评论

暂无评论...
验证码 换一张
取 消