我的问题是我无法用另一个数据表的值填充数据表。下面的代码:
foreach (DataRow row1 in ds.Tables["tests"].Rows)
{
//Use value stored in DataTable "tests" to generate
//new DataTable called "temp" and fill it with values
foreach (DataRow row2 in ds.Tables["temp"].Rows)
{
//use values in "temp"-table to fill fields in "tests"-table
-> if (specific condition in Datatable "tests" is met)
{
example1: row1.ItemArray[10] = Convert.ToInt64(row2.ItemArray[0]);
example2: ds.Tables["tests"].Rows[row1.Table.Rows.IndexOf(row1)].ItemArray[10] = Convert.ToInt64(row2.ItemArray[0]);
}
else if (another specific condition in Datatable "tests" is met)
{
//Different fields will be filled
}
}
}
当尝试调试程序时,在 if 语句的开头使用停止点,一切都会解决,直到程序跳转到 if 语句的执行块。
执行块中的每一行都被跳过。
这是我得到的读出信息(粗略翻译):
NonUserCode "System.Data.DataSet.Tables.get" is being skipped.
NonUserCode "System.Data.DataRow.ItemArray.get" is being skipped.
任何帮助,将不胜感激。谢谢!