Page 1 of 1

MysqlDataTable: Change key to not be uniqe

Posted: Thu 28 Feb 2019 11:22
by profixio
Hi!
I have a query used in mysqldatatable where a field in the table in the DB is set to uniqe:
http://sharing.profixio.com/uploads/201 ... 121744.png

Is it possible to set this field to something like "uniqe = false" in the configuration of the mysqdatatable?

Thanx! /Ole

Re: MysqlDataTable: Change key to not be uniqe

Posted: Fri 01 Mar 2019 16:05
by Pinturiccio
If a column is just a unique column, add the following line:

Code: Select all

mySqlDataTable.Columns["Column name"].Unique = true;
Replace "Column name" with the name of the unique column.

If a column is a primary key, it is added to the PrimaryKey collection of the MySqlDataTable object. Then add the following code:

Code: Select all

mySqlDataTable.PrimaryKey = null;[code]

Re: MysqlDataTable: Change key to not be uniqe

Posted: Fri 01 Mar 2019 17:47
by profixio
Perfect!! Thanx:-)