filling a strongly typed dataset with data that contains a varray

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

filling a strongly typed dataset with data that contains a varray

Post by kevinherring » Wed 04 Jan 2006 15:49

Hi

I have a strongly typed dataset that I would like to populate with some data using oradirect 3.01. The data contains a varray.

I have worked out how varrays work with vb.net (for those who dont already know):
You get a main table with a column that contains, instead of the varray, an autoincrement. You also get a child table called Table. For example if the column with a varray was called Readings, you would get a child table called TableReadings.

This table contains 2 columns, one has the same name as the table, and then other is just called 'Column1'. The first column contains the key from the parent table and the second column contains your actual array values. There is a relationship based on the columns mentioned above.

So my question is, how do I create that in a strongly typed dataset? I have tried duplicating the above, but I get the helpful error message saying it couldnt enable the constraints. Then I took the constraint between parent and child out, and now it says:
"Hierarchical chapter columns must map to an AutoIncrement DataColumn." google brings up no results. I have tried adding and removing keys to no avail.

The documentation is pretty poor regarding this, in fact generally I would say this product needs more documentation and examples. Can someone from corelab provide one please?

I would to use a regular .net dataset and table please.

Many thanks
Kevin

kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

Post by kevinherring » Wed 04 Jan 2006 16:12

ok, I have managed to get it to populate the two tables. The solution was to set autoincrement to true in the dataset designer for the column in the parent table.

However I am now getting the error:
"Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."

Which is a bit of a favourite of mine as it tells you absolutely nothing about the constraint, column, or value that caused it.

Anyway I only have row in the parent datatable and there are no constraints in either tables. I am assuming the .fill method of the oracle dataadapter tries to create some kind of constraint, but I dont see why it isnt working.

Any suggestions?
Thanks

kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

Post by kevinherring » Wed 04 Jan 2006 17:09

ok i finally got it.

the constraints error was caused by me not allowing dbnulls in a specific column, which subsequntly contained nulls. fixed it by changing minoccurs to 0 in the dataset designer.
(using table.geterrors is great when you get the constraints exception i mentioned above)

Now it would appear that the driver doesnt actually create any relationships between the tables so you might want to consider doing that at design time or after it has been populated.

Apologies for talking to myself, but I hope that it can help other people!

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Thu 05 Jan 2006 13:40

Yes, OraDirect .NET cannot generate relationships between the tables automatically. We plan to extend functionality of Generate DataSet wizard in the future.

Post Reply