Oracle DataTable and PrimaryKey

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Oracle DataTable and PrimaryKey

Post by degas » Mon 11 Apr 2011 20:21

The DevArt DataSet Desingner does not generates a PrimaryKey of the datatables. Instead is adds a unique constraint.
This causes that the merge method does not work, because this is based on the primaryKey property.
I am using version 5.20.33.0

This is the generated code of the InitClass():

.....
this.columnIdProvincia = new System.Data.DataColumn("IdProvincia", typeof(int), null, System.Data.MappingType.Element);
base.Columns.Add(this.columnIdProvincia);
this.columnNombre = new System.Data.DataColumn("Nombre", typeof(string), null, System.Data.MappingType.Element);
base.Columns.Add(this.columnNombre);
this.columnNemonico = new System.Data.DataColumn("Nemonico", typeof(string), null, System.Data.MappingType.Element);
base.Columns.Add(this.columnNemonico);
this.columnNombreMEG = new System.Data.DataColumn("NombreMEG", typeof(string), null, System.Data.MappingType.Element);
base.Columns.Add(this.columnNombreMEG);
this.Constraints.Add(new System.Data.UniqueConstraint("Constraint1", new System.Data.DataColumn[] {
this.columnIdProvincia}, false)); <-----Here it should be true, because it is a Primary Key
this.columnIdProvincia.AllowDBNull = false;
this.columnIdProvincia.Unique = true;
.......

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 13 Apr 2011 11:40

I have generated DataSets using dotConnect for Oracle v 5.20.33 with both generators:
1) the Data > Add New Data Source menu of Visual Studio;
2) Tools > Oracle > DataSet Wizard.

The result is the same:
this.Constraints.Add(new System.Data.UniqueConstraint("Constraint1", new System.Data.DataColumn[] {
this.columnIdProvincia}, true));


My test table:
CREATE TABLE DEPT (
DEPTNO NUMBER(2),
DNAME VARCHAR2(14),
LOC VARCHAR2(13),
CONSTRAINT PK_DEPT PRIMARY KEY (DEPTNO))


Please give us the following information:
1) which generator you are using;
2) does the problem persist with the DEPT table in your environment? If not, please post here the DDL script of your table to reproduce the issue.

degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Post by degas » Wed 13 Apr 2011 13:37

I think i found the bug. If you generate the dataset for the first time you have no problem and it works fine, but when you want to modified it, by selecting an existing dataSet, you get the mentioned error.
To reproduce it follow the steps:
1)Open the DataSetWizard and add a new dataset and add only the Dept table.
2)Generate the dataSet
3)Open again the DataSetWizard and select the previous generated dataSet.
4)Don't change anything, simply press next.

If you look at the generated code after step 2 you will see this,

private void InitClass() {
.......
this.Constraints.Add(new System.Data.UniqueConstraint("Constraint1", new System.Data.DataColumn[] {
this.columnDEPTNO}, true)); <---OK!!!!
.......
}

But if you modify the dataset (actually i didnt change anything) you should see this
private void InitClass() {
.......
this.Constraints.Add(new System.Data.UniqueConstraint("Constraint1", new System.Data.DataColumn[] {
this.columnDEPTNO}, false));<---IT SHOULD BE TRUE!!!!!
.......
}

It is urgent to find a solution to this. Thanks

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 14 Apr 2011 10:06

We have reproduced the issue. I will post here when the new build with this fix is available for download.

degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Post by degas » Thu 14 Apr 2011 13:45

Are planning to fix the version 5.20.33 or simply in the newest version?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 18 Apr 2011 06:55

We are going to include the fix into the next build after the issue is fixed.

degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Post by degas » Wed 16 Nov 2011 20:32

I have downloaded the new trial version and there is still no fix to this problem? The fact that the PK is not defined as such, make the method LoadDataRow useless.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 17 Nov 2011 10:10

Sorry for the delay. We will fix the problem before the next public build of dotConnect for Oracle and post here when it is available for download.

degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Post by degas » Wed 07 Dec 2011 14:29

any news?

degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Post by degas » Wed 07 Dec 2011 14:29

any news?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 07 Dec 2011 17:10

The bug with setting the PrimaryKey attribute of DataTable.Constraints when editing an existing DataSet using DataSet Wizard is fixed. We will post here when the corresponding build of dotConnect for Oracle is available for download.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 22 Dec 2011 17:03

New build of dotConnect for Oracle 6.60.268 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=22977 .

Post Reply