Dynamic SQL generation failing
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
Subject
Written By
Posted
Dynamic SQL generation failing
May 06, 2021 07:13AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.