MasterWoodsman
asked on
MySQLDataAdapter doesn't set AutoIncrement property in Datatable
Hi Experts,
I have a MySql table with a column set to AutoIncrement=True and NotNull=True. Type is Int(10) Unsigned. My Application needs to add records to an in-memory datatable and them use the adapter to save the changes.
When I create a MySQLDataAdapter and fill my table it is supposed to set the DataColumn.AutoIncrement to true after reading the schema from the database. It is not. I tried many ways to fill the data and none of them are working.
In every case my Datacolumn.Autoincrement=F alse.
Is there something I am doing wrong?
I am using MySQL 5.5.39-MariaDB and VB.NET 4.0
Now I could work around this by not using the autoincrement and using a GUID as a primary key instead, but I'd like to try the "normal" way of working with the table.
I have a MySql table with a column set to AutoIncrement=True and NotNull=True. Type is Int(10) Unsigned. My Application needs to add records to an in-memory datatable and them use the adapter to save the changes.
When I create a MySQLDataAdapter and fill my table it is supposed to set the DataColumn.AutoIncrement to true after reading the schema from the database. It is not. I tried many ways to fill the data and none of them are working.
Public Adapter As MySqlDataAdapter
Adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
Adapter.Fill(MyDataSet, "MyTable")
I also triedPublic Adapter As MySqlDataAdapter
Adapter.FillSchema(MyDataSet, SchemaType.Source, "MyTable")
Adapter.Fill(MyDataSet, "MyTable")
as well as SchemaType.Mapped.In every case my Datacolumn.Autoincrement=F
Is there something I am doing wrong?
I am using MySQL 5.5.39-MariaDB and VB.NET 4.0
Now I could work around this by not using the autoincrement and using a GUID as a primary key instead, but I'd like to try the "normal" way of working with the table.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
My full code is
Open in new window
Thanks for the help!