数据表逐行迭代和打印

时间:2014-04-23 11:10:33

标签: c# asp.net datatable itextsharp stringwriter

我有一个datatable我需要按行迭代并使用C#在ASP.NET中使用iTextSharp进行打印。

对于在父datatable dt 中检索到的每一行,我打印一个子表 dt_child dt_child 正在完美打印。但是父 dt 的行不会以表格方式打印。

我目前正在使用下面指定的代码。但我需要更好的代码。由于 dt 未正确显示。

foreach (DataRow dr in dt.Rows)
    {

    //The way I print the dt row needs to be changed
    foreach (DataColumn dc in dt.Columns)
    {
       stringWrite.Write(dr[dc]);
    }

    //Code Below this works perfectly
    key=dr["key"].ToString();
    dt_child = getDataTablebyProcedure("ChildProcedure",key);
    stringWrite = getStringWriterbyDataTable(dt_child, stringWrite);

    }

Issue

0 个答案:

没有答案