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?
DataPortal.Fetch(criteria);
}
private void DataPortal_Fetch(object criteria)
{
//how do?
}
help~ thanks~
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.
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.
Jav
Jav,
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.
Joe
Copyright (c) Marimer LLC