ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

C#Datatable 根据某字段 自动复制该行

2022-06-23 11:35:49  阅读:26  来源: 互联网

标签:某字段 C# int Rows Ifileid dt Datatable row


/// <summary>
/// 根据Datatable某字段数量自动复制该行查询
/// </summary>
/// <param name="dt">数据源</param>
/// <param name="Ifileid">某字段(数量值)</param>
private static void UpdatateDt(DataTable dt, string Ifileid)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
var row = dt.Rows[i];
int Ifileid= int.Parse(row["Ifileid"].ToString());
for (int j = 0; j < Ifileid- 1; j++)
{
DataRow newRow = dt.NewRow();
newRow.ItemArray = row.ItemArray;
dt.Rows.InsertAt(newRow, i + 1);
}
i += Ifileid- 1;
}
}
}

标签:某字段,C#,int,Rows,Ifileid,dt,Datatable,row
来源: https://www.cnblogs.com/jiaozai891/p/16404408.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有