我正在做SSIS pakage,我通过C#完成了大部分工作但是我想要添加的是每个输出文本文件的记录数。什么我尝试永远不会工作,我得到一个错误或我得到所有文件的第一个输出文件的计数。需要帮助。谢谢 这是我的剧本
// Write the Header Row to File
int ColumnCount = d_table.Columns.Count;
// Dts.Events.FireInformation(0, "DataTable Rows", RecordsInserted.ToString(), "", 0, ref fireAgain);
//
// Write All Rows to the File
foreach (DataRow dr in d_table.Rows)
{
for (int ir = 0; ir < ColumnCount; ir++)
{
if (!Convert.IsDBNull(dr[ir]))
{
sw.Write(dr[ir].ToString());
}
if (ir < ColumnCount - 1)
{
sw.Write(FileDelimiter);
}
// RecordsInserted = dt.Rows.Count;
// Dts.Events.FireInformation(0, "DataTable Rows", RecordsInserted.ToString(), "", 0, ref fireAgain);
}
sw.Write(sw.NewLine);
}
/////////////////////
sw.Write(",Insurance," + rctn);
sw.Write(sw.NewLine);
// sw.Write("Row count: " + RowCount.ToString());
this is some of what i tried but nothing works for me
// sw.Write("Row count: " + RowCount.ToString());
sw.Close();
}
}
}
答案 0 :(得分:0)
您的代码示例看起来不完整,但我注意到RowCount
没有任何声明。你需要它是这样的吗?
sw.Write("Row count: " + d_table.Rows.Count.ToString());