Put content of a temp-table into a .Net DataTable

Posted by tbergman on 25-Mar-2016 07:06

I'm looking into ways to accomplish getting the data from a Progress Temp-Table into a .Net System.Data.DataTable from inside an ABL session. There are two ways I know of that can do this.

1) Go through the temp-table dynamically and do field by field writes to the DataTable. This works fine, is very flexible in terms of making minor data changes as needed like formatting a field, but is a little slow.

2) Use Progress Write-Xml and the DataTable ReadXml methods. Faster but no flexibility on minor data changes.

I'm wondering if there's a cleaner way, possibly using a ProBindingSource or possibly the Open Client Dll?

Again, I want to do this within an ABL session, not across the AppServer. Of course, ProDataSet to System.Data.Dataset would also be of interest if there's any reason that's easier.

Thanks,

Tom

All Replies

Posted by Laura Stern on 25-Mar-2016 07:11

The 2 ways you said are all I can think of, though of course for #1 it does not have to be by dynamic access to the temp-table.  You cannot use the ProBindingSource.

Posted by Thomas Wurl on 25-Mar-2016 10:32

The question is what you are going to do with this Data Table?

I had the same problem that passing data to a .Net object (like a Data Table) is incredibly slow. Looping in the 4GL is slow compared to C#. Passing mass data through the bridge adds another big overhead.

The solution that worked for me is passing schema information and the data itself to .Net via Json. You could write a class in C# that inherits the DataTable and has some additional methods to talk to OpenEdge.

But everything depends on what you want to do with the data table. If you want to bind this to a another .Net control then conside writing a UserControl in C# with your data table and the other control and talk to open edge via json.

Regards,

Thomas

Posted by Mike Fechner on 25-Mar-2016 12:01

If you are familiar with reflection in. NET, you could write a C# class that reflects through a System.Windows.Forms.DataSource and at runtime iterate a Probindingsource that way.

This thread is closed