MysqlDataTable: Change key to not be uniqe

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
profixio
Posts: 5
Joined: Wed 10 Dec 2014 10:04

MysqlDataTable: Change key to not be uniqe

Post by profixio » Thu 28 Feb 2019 11:22

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

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: MysqlDataTable: Change key to not be uniqe

Post by Pinturiccio » Fri 01 Mar 2019 16:05

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]

profixio
Posts: 5
Joined: Wed 10 Dec 2014 10:04

Re: MysqlDataTable: Change key to not be uniqe

Post by profixio » Fri 01 Mar 2019 17:47

Perfect!! Thanx:-)

Post Reply