DataTable dtPay = dgvPay.DataSource as DataTable;
DataTable dtReceive = dgvReceive.DataSource as DataTable;
if (dtPay != null)
{
if (dtReceive.Rows.Count == dtPay.Rows.Count)
{
for (int i = 0; i < dtPay.Rows.Count; i++)
{
dtReceive.Rows[i]["IsOriginal"] = dtPay.Rows[i]["IsOriginal"];
}
}
else if (dtPay.Rows.Count > dtReceive.Rows.Count)
{
int j = 0;
for (int i = 0; i < dtPay.Rows.Count; i++)
{
for (; j < dtReceive.Rows.Count; )
{
dtReceive.Rows[j]["IsOriginal"] = dtPay.Rows[i]["IsOriginal"];
j++;
break;
}
}
}
else if (dtPay.Rows.Count < dtReceive.Rows.Count)
{
int j = 0;
for (int i = 0; i < dtReceive.Rows.Count; i++)
{
for (; j < dtPay.Rows.Count; )
{
dtReceive.Rows[i]["IsOriginal"] = dtPay.Rows[j]["IsOriginal"];
j++;
break;
}
}
}
}谢拉
解决方案 »
- 例如IIS开了80端口,它是怎么识别几千个人同时访问的?
- GridView 前几列固定 后边列可以拖动 怎么实现?
- c#关于大写字母的判断
- 在线等 点击datagridview 某一行,然后出现相关事件!
- 关于JS脚本中用escape()转过的字符,在C#中怎么解码的问题,急、急、急!!!!!!!!
- 几个Nhibernate的问题,有经验的朋友进来看啊~~~
- 当系统扑捉到错误后,怎样才能将该错误清除掉?
- DataGrid当处于编辑状态的时候,如何不显示删除按钮列?
- GDI+编程问题
- c#多表查詢結果數據集更新問題
- 编译运行报错,不存在类型或命名空间System.Security
- 请教一下如下C++算法如何转化为C#的
DataTable dtPay = dgvPay.DataSource as DataTable;
DataTable dtReceive = dgvReceive.DataSource as DataTable;
if (dtPay != null)
{
int length = dtReceive.Rows.Count > dtPay.Rows.Count ? dtPay.Rows.Count : dtReceive.Rows.Count;
for (int i = 0; i < length; i++)
{
dtReceive.Rows[i]["IsOriginal"] = dtPay.Rows[i]["IsOriginal"];
}
}是这个意思不?