How to efficiently convert data to DataTable in ADO.Net
I am using ADO.Net
+ C#
+ VSTS 2008
+ SQL Server 2005
. I bind ADO.Net
DataTable
to a real database table and then bind DataTable
to a grid view on the page ASP.Net
.
My question is, if I want to do some data processing work (very simple, for example, add some prefix to some character data type strings, 100 data type integers or whatever) and display the managed data in a grid view to the page, what is the proposed solution for efficiently working with data?
I cannot change data inside the database.
a source to share
ADO.NET DataSet allows the use of "computed" columns. Look at the MSDN page on DataColumn.Expression for a summary of the kinds of expressions supported.
If you are in the visual designer of the DataSet, just right click on your table and add a column, then fill in the expression in the Properties field. Otherwise, it's pretty easy to create a new DataColumn in code, set its Expression property, and add it to your DataTable.
a source to share