不多说,直接贴出源码:
foreach (DataRow dr in dt.Rows)
{
var filename1= dr["FileName1"];
var fileName2 = dr["FileName2"];
DataTable dt2 = GetOperation(filename1.ToString(), fileName2 .ToString());
StringBuilder db = new StringBuilder();
//用ToList()将查询结果转化为List集合
var operation = from DataRow drow in dt2.Rows
select drow["FileName3 "];
var operationList=operation.ToList();
foreach(var p in operationList)
{
db.Append(p+",");
}