对象名称“aspnet_Membership”无效

发布于 2024-10-17 14:15:27 字数 847 浏览 6 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

简单气质女生网名 2024-10-24 14:15:27

表 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文