C# MySqlException: Table 不存在 - 数据库名称列出了两次
C# MySqlException: Table doesn't exist - Database name listed twice
我在通过 C# 应用程序访问的 MySQL 数据库中尝试 return 简单数据时遇到问题。
这是导致问题的代码及其在 Visual Studio 中产生的错误:
using (U04BWFEntities db = new U04BWFEntities())
{
city theCity = new city();
customer userQuery = db.customers.First();
tbox_DebugDB.Text = userQuery.ToString();
}
并且报错如下:
System.Data.Entity.Core.EntityCommandExecutionException
HResult=0x8013193C
Message=An error occurred while executing the command definition. See the inner exception for details.
Source=EntityFramework
Inner Exception 1:
MySqlException: Table 'U04BWF.U04BWF.customer' doesn't exist
作为数据库名称的 U04BWF 片段在执行此查询时似乎出现了两次,因此错误是准确的 -- U04BWF。U04BWF.customer 不存在,但 U04BWF.customer确实。
我真正的问题: 我不知道为什么代码试图 运行 这样的查询。我无法找到它决定 运行 针对 U04BWF 的查询的位置。U04BWF.customer 而不是它 应该 的内容 (U04BWF.customer).
正如您从代码中看到的那样,我正在使用 Entity Framework,据我所知,它正确地创建了实体,但我对 EF 很陌生,可能根本不知道什么时候出现问题我看到一个。
我可以将连接切换到 ADO 并使用非 EF 方法成功执行查询。
我主要是在寻求有关如何追踪此问题的指导。提前致谢!
这是 MySql.Data.EntityFramework 8.0.22 中的错误:bug 101236。
作为解决方法,您可以降级到 8.0.21。 Oracle 声称它将在下一个版本 8.0.24 中修复。
我在通过 C# 应用程序访问的 MySQL 数据库中尝试 return 简单数据时遇到问题。
这是导致问题的代码及其在 Visual Studio 中产生的错误:
using (U04BWFEntities db = new U04BWFEntities())
{
city theCity = new city();
customer userQuery = db.customers.First();
tbox_DebugDB.Text = userQuery.ToString();
}
并且报错如下:
System.Data.Entity.Core.EntityCommandExecutionException HResult=0x8013193C Message=An error occurred while executing the command definition. See the inner exception for details. Source=EntityFramework
Inner Exception 1: MySqlException: Table 'U04BWF.U04BWF.customer' doesn't exist
作为数据库名称的 U04BWF 片段在执行此查询时似乎出现了两次,因此错误是准确的 -- U04BWF。U04BWF.customer 不存在,但 U04BWF.customer确实。
我真正的问题: 我不知道为什么代码试图 运行 这样的查询。我无法找到它决定 运行 针对 U04BWF 的查询的位置。U04BWF.customer 而不是它 应该 的内容 (U04BWF.customer).
正如您从代码中看到的那样,我正在使用 Entity Framework,据我所知,它正确地创建了实体,但我对 EF 很陌生,可能根本不知道什么时候出现问题我看到一个。
我可以将连接切换到 ADO 并使用非 EF 方法成功执行查询。
我主要是在寻求有关如何追踪此问题的指导。提前致谢!
这是 MySql.Data.EntityFramework 8.0.22 中的错误:bug 101236。
作为解决方法,您可以降级到 8.0.21。 Oracle 声称它将在下一个版本 8.0.24 中修复。