(DotNet) NET (2013 год)

ConvertDataTableToString - simple function to debugging.

This extremely simple extension Dataset function I usually use to debugging ASP.NET web sites. Please, see more interesting extension function. How to reorder DataRow with Extension function, Anonymous types, Lambda Expression and Linq Special Row Comparer.

   1:  Imports Microsoft.VisualBasic
   2:   
   3:   
   4:  Public Module Extension7
   5:   
   6:      <Runtime.CompilerServices.Extension()> _
   7:      Public Function ConvertDataTableToString(Of T As Data.DataTable)(ByVal dt As T) As String
   8:          Dim Str1 = New StringBuilder()
   9:          For Each Row As Data.DataRow In dt.Rows
  10:              For Each Col As Data.DataColumn In dt.Columns
  11:                  Str1.AppendFormat("{0}:{1} ", Col.ColumnName, Row(Col))
  12:              Next
  13:              Str1.Append(vbCrLf)
  14:          Next
  15:          Return Str1.ToString()
  16:      End Function
  17:  End Module

Below you may see a trace result of this simple extension.





Comments ( )
<00>  <01>  <02>  <03>  <04>  <05>  <06>  <07>  <08>  <09>  <10>  <11>  <12>  <13>  <14>  <15>  <16>  <17>  <18>  <19>  <20>  <21
Link to this page: //www.vb-net.com/DataTable-SortRows/ConvertDataTableToString.htm
<SITEMAP>  <MVC>  <ASP>  <NET>  <DATA>  <KIOSK>  <FLEX>  <SQL>  <NOTES>  <LINUX>  <MONO>  <FREEWARE>  <DOCS>  <ENG>  <CHAT ME>  <ABOUT ME>  < THANKS ME>