DataRowView rvTbl;
BindingSource bs = new BindingSource();
bs.DataSource = dsData1;
bs.DataMember = _sheetname;
Excel.Worksheet _workSheet = (Worksheet)_workbook.Worksheets.get_Item(_sheetIndex);
Range rangerow in _workSheet.UsedRange.Rows
上面是定义
bs.CurrencyManager.AddNew();
rvTbl = (DataRowView)bs.CurrencyManager.Current;
ctr = 0;
for (int i = 0; i < rangerow.Columns.Count; i++)
{
if (rangerow.Cells[1, i + 1].Value2 != null)
{
rvTbl[fLine[ctr]] = rangerow.Cells[1, i + 1].Value2.ToString();
MessageBox.Show(Convert.ToString(rvTbl[fLine[ctr]]));
ctr++;
}
}
bs.CurrencyManager.EndCurrentEdit();
以上是我的处理导入文件并填充数据的代码,我的问题是“是否有办法检查数据是否已存在?”我该怎么办?