Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

How to logically extend System.Data.DataTable and System.Data.DataRow?

How to logically extend System.Data.DataTable and System.Data.DataRow?


I execute a query in C# and get a DataTable with DataRows. But, I am looking for the best way to extend a DataRow, with additional column's of data.


For example, the returned DataRows may have 5-columns, based on what is in the Select statement. Then, as part of the analysis, I need to add more data, for each DataRow.


Does it make sense to simply Add() a few new DataRows? Or, should I consider creating my own class, that inherits from DataTable and DataRow?


Please feel free to include various ways to extract DataRows, or a certain DataRow, based on some unique value, like ID, when using the built-in object structure mentioned.


Thanks





ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

I am sorry, I meant DataColumn. I would need to increase the size of the DataRow by adding a few more columns.

Is this still within the bounds of normal usages of a DataTable and a DataRow object?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I like the use of an Extension Method. Thanks for reminding me.