DataTable Primary Key auto increment not being set from data adapter RRS feed

  • Question

  • I have a DataSet that I have populated from a select query on a MySql database. The DataSet has three DataTable's. When I look at the DataColumn (primary key) the autoincrement property on table1(I hav'nt looked at the others yet) is set to false. But according to MySql it's set to true. It will auto increment if an insert query is issued from MySql.


    This is how the field looks in MySql :

    `id` int(10) unsigned NOT NULL auto_increment,

    PRIMARY KEY  (`id`)


    Here is the C# code used to populate the DataSet:

    string mQuery = "SELECT * FROM Table1;SELECT * FROM Table2;SELECT * FROM Table3";

    MySqlDataAdapter mMyDataAdapter = new MySqlDataAdapter(mQuery, mMyConn);



    The DataColumb has the following prperties:

    AutoIncrement = false

    AutoIncrementSeed = 0

    AutoIncrementStep = 1

    Caption = "id"

    Unique = false



    Thanks in advance for you help.

    lee Wink

    Friday, November 9, 2007 6:56 PM