DataTable.PrimaryKeys

DataTable.PrimaryKeys

Postby inTrance » Tue 04 Apr 2006 17:16

Hello!

Is there any possibility to force MySQLDirect to fill in properties like DataTable.PrimaryKeys or DataColumn.AutoIncrement? I think this is more comfortable than using GetSchema.

// Edit: And when I have to use GetSchema: Does it work with all MySQL server systems ranging from 3.x to 5.x?

Kind Regards,

Florian Heinemann
inTrance
 
Posts: 10
Joined: Tue 04 Apr 2006 17:07

Postby Alexey » Wed 05 Apr 2006 13:35

You may use FillSchema method of MySqlDataAdapter. See the code snippet below:
Code: Select all
      DataTable myTable = new DataTable();
      mySqlDataAdapter1.FillSchema(myTable, SchemaType.Source);
      for (int i = 0; i < myTable.Columns.Count; i++)
         MessageBox.Show(myTable.Columns[i].AutoIncrement.ToString());

or
Code: Select all
      for (int i = 0; i < myTable.PrimaryKey.Length; i++)
        MessageBox.Show(myTable.PrimaryKey[i].ToString());

Note that you'll have to configure mySqlDataAdapter1 before using it.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL