对象名称“aspnet_Membership”无效
我使用 Visual Studio 和 C# win 表单(Web 表单)。我尝试打开与 MS 2005 Server 和阅读器查询的连接。这里 - 是
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";
并且这些表存在于数据库中。对象名称“aspnet_Membership”无效。 描述:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。
异常详细信息:System.Data.SqlClient.SqlException:对象名称“aspnet_Membership”无效。
来源错误:
Line 47: SqlCommand cmd = new SqlCommand(sql, con);
Line 48: con.Open();
Line 49: SqlDataReader reader = cmd.ExecuteReader();
Line 50: string str = "";
我很沮丧。提前致谢
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_Membership'.
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
表 aspnet_Membership 不存在或无法访问。使用 SQL Server Management Studio 确定它是否存在。也可能是您连接到了错误的数据库。仔细检查您的连接字符串
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