Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Writing INSERTs and UPDATEs back to the DB using C# DataRow[] array

752035Feb 7 2010 — edited Feb 12 2010
Hello all,

Have a small query regarding sending back INSERTs and UPDATEs back to the DB.

Here is the background:
1. Backend Database is Oracle XE.
2. Front end is Winforms application using C#
3. ODP.NET version is 10.2.0.100
4. Updates and Inserts are already working using Associative Arrays. (as shown in the demonstation examples). For INSERTing a single record, I am sending an array with one array element for each column of the record. For multiple record INSERT, I am sending as many arrays as the number of columns and this is working fine. In both cases, I am calling a stored procedure to perform the INSERT.

I was wondering if we can instead pass an array of records directly to the backend.
For e.g.
in C#, I can say:

DataRow [] newRows; //an array of DataRow objects
String sFilter = ""; //Filter expression - set to no filter
String sSort = ""; //Sort expression - set to no sorting

//then use the DataTable's SELECT property to return an array of DataRow objects
newRows = ds.Tables["Customer"].Select(sFilter,sSort,DataViewRowState.Added); //where ds is the DataSet

So this way, at the C# end, I can get hold of an array of the newly added rows using the DATATABLE's SELECT property. Now I want to send over this DataRow[] array directly to a stored procedure at the back end.

So here are my doubts:
1. Can this be done at all ?
2. Do I need to update my ODP.Net version to 11 to do that, or will it work using ODP.Net 10.2 as well ? (as per some other related searches I performed on the forum)
3. How is to be passed from C# ? i.e. what must be Oracle Parameter Type settings ?
4. How to receive this DataRow [] array parameter at the back end ? i.e.; what will be the receiving parameter type ?

I have spent quite a bit of time on this, but have not made any significant headway. Your help in solving my queries will be much appreciated.

Best Regards and Thanks in advance.

Edited by: user6601744 on 07-Feb-2010 08:20
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 12 2010
Added on Feb 7 2010
9 comments
3,129 views