Passing a ProDataSet to .NET in 10.2

markjonesnz

New Member
Hello,

I am trying to pass a ProDataSet to a .Net method that takes a System.Data.DataSet but it just doesnt work... I have spent a couple of hours searching for an example of how to do this and been looking through mountains of progress manuals and it says you can pass them to .NET but nowhere does it actually show you how to do this.. and it is starting to drive me insane. This is my very simple test program

def temp-table t-dept like dept.
def dataset ds-dept for t-dept.
def net-data as System.Data.DataSet.
net-data = ds-dept.

I have tried = dataset ds-dept, dataset-handle ds-dept, cast( ) etc but nothing seems to work.

Please Help!!

Mark
 

markjonesnz

New Member
I spent some time with a guy from progress looking at this and it seems that the manual is a bit mis-leading and there isn't a direct way to map from a progress dataset to a .net dataset. It sort of looks like it could be acheived using proxygen etc but that gets quite messy.

We did discover that the reporting tool I was using did (indirectly) support a binding source, so we could do RegisterData(new Progress.Data.BindingSource(dataset ds:handle) ). Which all looked good but then I discovered a bug in the reporting tool with the binding source that meant I couldnt use it...

It is possible to convert a progress dataset to a .net dataset by using the :write-xml( ) method to export the dataset and schema to a file and then create a System.Data.DataSet and use the :Load( ) method to import the data, not the most efficent way of doing things but it does work. I ended up creating a .net method so that I could do the whole thing in memory via a memptr (without having to export to a file)

def dataset ds for t-data.
def var net-data as System.Data.DataSet.
def var net-stream as System.IO.Stream.
def var l-data as memptr.
dataset ds:write-xml("memptr",l-data,false,?,?,true).
net-stream = TodaySoftware.Corp.Util.Data:MemptrStream(get-pointer-value(l-data),get-size(l-data)).
net-data = new System.Data.DataSet().
net-data:ReadXml(net-stream).

The guy I was dealing with at progress also said they may look at providing a built in class in the future to help with interop between the system (similar to the current BindingSource), i.e.
= new Progress.Data.DataSet(dataset ds:handle)

so there we go...
 
Top