/// This method outputs on values of the passed dataset objects for easier debugging
///
/// the string passed containng usual info
/// the dataset , which content one should debug
/// call it this way Debugger.debugDataSet ( System.Reflection.MethodInfo.GetCurrentMethod().Name() , , ref ds );
public static void debugDataSet ( string msg , ref System.Data.DataSet ds )
{
System.Diagnostics.Debug.WriteLine ( msg );
foreach (System.Data.DataTable dt in ds.Tables)
{
System.Diagnostics.Debug.WriteLine ("================= Table " +
dt.TableName + " ========================= START");
foreach (System.Data.DataColumn dc in dt.Columns)
{
System.Diagnostics.Debug.Write(" | ");
System.Diagnostics.Debug.Write(dc.ColumnName + " | ");
} //eof foreach (DataColumn dc in dt.Columns)
int rowNumber = 0 ;
foreach (System.Data.DataRow dr in dt.Rows)
{
System.Diagnostics.Debug.Write ( "\n row " + rowNumber + " --- " );
int colNumberInRow = 0 ;
foreach (System.Data.DataColumn dc in dt.Columns)
{
System.Diagnostics.Debug.Write(" |" + colNumberInRow + "| ");
System.Diagnostics.Debug.Write(dr[dc].ToString() + " ");
colNumberInRow ++ ;
} //eof foreach (DataColumn dc in dt.Columns)
rowNumber ++ ;
} //eof foreach (DataRow dr in dt.Rows)
System.Diagnostics.Debug.Write ( " \n" );
System.Diagnostics.Debug.WriteLine ( "================= Table " +
dt.TableName + " ========================= END" );
} //eof foreach (DataTable dt in ds.Tables)
} //eof public static void debugDataSet ( string msg , ref System.Data.DataSet ds )
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!