Elliott J.
Elliott J.

Reputation: 41

C# MySqlException: Table doesn't exist - Database name listed twice

I am encountering a problem when attempting to return simple data from a MySQL database I am accessing via a C# application.

Here is the code causing the issue and the error it produces in Visual Studio:

using (U04BWFEntities db = new U04BWFEntities())
{
    city theCity = new city();
    customer userQuery = db.customers.First();
    tbox_DebugDB.Text = userQuery.ToString();
}

And the error as follows:

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

The U04BWF piece, being the database name, appears to show up twice when it is executing this query and thus the error is accurate -- U04BWF.U04BWF.customer does not exist, but U04BWF.customer does.

My Real Problem: I do not know why the code is trying to run the query like this. I cannot track down where it is deciding to run the query against U04BWF.U04BWF.customer as opposed to what it should be (U04BWF.customer).

As you can see from the code, I am utilizing Entity Framework and, from what I can tell, it created the entities correctly, but I am very new to EF and may simply not know a problem when I see one.

I can switch the connection to ADO and successfully perform queries using non-EF methods.

Mostly I am seeking guidance on how to track this issue down. Thank you in advance!

Upvotes: 0

Views: 2138

Answers (1)

Bradley Grainger
Bradley Grainger

Reputation: 28162

This is a bug in MySql.Data.EntityFramework 8.0.22: bug 101236.

As a workaround, you can downgrade to 8.0.21. Oracle claims it will be fixed in the next release, 8.0.24.

Upvotes: 2

Related Questions