The DataPortal.Fetch can return a DataTable object?

The DataPortal.Fetch can return a DataTable object?

Old forum URL:

ohaiyo posted on Thursday, April 01, 2010

I want to Get specified column data from table, and return  a DataTable object!  How do it?

        public static System.Data.DataTable GeDataTable(string[] columns)
             //how do?

        private void DataPortal_Fetch(object criteria)
            //how do?


help~ thanks~

RockfordLhotka replied on Thursday, April 01, 2010

I think the DataTable is serializable? If it is then you can just make it a field of your object.

I would use a command object. The BusinessBase and ReadOnlyBase classes will not help you manage a DataTable, and some of the features of BusinessBase might actually conflict with the DataTable. But a command object (CommandBase) is just a container for fields, so it might be better.

This will only work if the DataTable can be serialized using the BinaryFormatter and/or NetDataContractSerializer - and I think it can be.

And of course this is totally useless for Silverlight, because there is no DataTable on Silverlight.

Jav replied on Thursday, April 01, 2010

I am not sure that dataTable can be serialized.  I recall struggling with that a couple of years ago.  From what I remember, I had to work with a DataTable within a DataSet before I could make it work - which was not too big a deal.  I was working with .Net Framework 2.0 then.


JoeFallon1 replied on Sunday, April 04, 2010


You are correct as far as your experience went. But MS fixed it in a later version of .Net so that you could serialize the DataTable itself without having to embed it in a dataset anymore.


Copyright (c) Marimer LLC