显示数组中的数据 [英] Displaying Data from an Array
本文介绍了显示数组中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我遇到了这个问题,忙碌的程序从一个唯一的标识符(即电子邮件地址)获取客户详细信息.
现在,当我想在数据网格上显示数据时,它仅显示重复的两行.
这是在做什么:
Hi Guys,
I got this problem, the programe that am busy with gets customers details from one unique identifier being the email address.
Now when I want to display the data on a data grid it only shows the two rows which are duplicate.
This is what am doing:
int _lineItem = 0;
int _insertCount = 0;
string[] _line = values;
int tabcount = _line.Length;
//string[] _mail_cnt = myEmails;
for (int ii = 0; ii < myEmails.Count; ii++)
if (_line.Length > 0)
{
dtOutput.Rows.Add(new object[] {
_line[0].ToString(),
_line[1].ToString(),
_line[2].ToString(),
_line[3].ToString(),
_line[4].ToString(),
_line[5].ToString(),
_line[6].ToString()
});
imported++;
}
_lineItem++;
_insertCount++;
Please can you assist?
推荐答案
您填充网格数据的逻辑取决于两件事:电子邮件计数和值计数...
如果仅显示2个重复行,则值存在一些问题.您需要看看那里.
简单地使用DEBUGGER可以告诉您问题出在哪里以及哪里出了问题.
最后一件事,本来可以有一种更清洁的方式来做您要尝试的事情.另外,请尝试保留有意义的变量名称,以提高代码的可读性.
Your logic to populate the grid data depends on two things here... Email Count and Values count...
If it show 2 duplicate rows only then there is some problem with the values. You need to look there.
A simple use of DEBUGGER can tell you what and where things are going wrong.
Last thing, there could had been a cleaner way to do what you are trying. Also, try to keep a meaningful names of variable, that increases readability of code.
这篇关于显示数组中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文