I have a Windows application in c# using the MySQL .NET connector 8.0.24
I continually get the Dynamic SQL Generation error with the reason that the Select statement does not contain Primary Key info.
I am using simple MySQL Tables that all have primary keys and I use simple Select Statements "SELECT * FROM Table_Name".
Code:
var sc = new MySqlConnection(MySQLConnectString);
var sa = new MySqlDataAdapter("SELECT * FROM Table_Name", sc);
var ds = new DataSet();
sa.Fill(ds, "Acct");
var builder = new MySqlCommandBuilder(sa);
builder.ConflictOption = ConflictOption.OverwriteChanges;
sa.InsertCommand = builder.GetInsertCommand();
sa.DeleteCommand = builder.GetDeleteCommand();
sa.UpdateCommand = builder.GetUpdateCommand();
This code has worked for years in this app connecting to MySQL Community Server 5 and 8 running on a Windows 10 Machine. I am trying to migrate to MySQL Community Server 8.0.24 running on a Linux Box. This is when the error started.
I have double checked the tables through MySQL Workbench and all of the tables have primary keys. If I comment out the builder lines, the app successfully connects to and pulls data from the server.
What am I missing here?
Thanks!
Dave Harvey
I continually get the Dynamic SQL Generation error with the reason that the Select statement does not contain Primary Key info.
I am using simple MySQL Tables that all have primary keys and I use simple Select Statements "SELECT * FROM Table_Name".
Code:
var sc = new MySqlConnection(MySQLConnectString);
var sa = new MySqlDataAdapter("SELECT * FROM Table_Name", sc);
var ds = new DataSet();
sa.Fill(ds, "Acct");
var builder = new MySqlCommandBuilder(sa);
builder.ConflictOption = ConflictOption.OverwriteChanges;
sa.InsertCommand = builder.GetInsertCommand();
sa.DeleteCommand = builder.GetDeleteCommand();
sa.UpdateCommand = builder.GetUpdateCommand();
This code has worked for years in this app connecting to MySQL Community Server 5 and 8 running on a Windows 10 Machine. I am trying to migrate to MySQL Community Server 8.0.24 running on a Linux Box. This is when the error started.
I have double checked the tables through MySQL Workbench and all of the tables have primary keys. If I comment out the builder lines, the app successfully connects to and pulls data from the server.
What am I missing here?
Thanks!
Dave Harvey