我有一个 DataView,它被过滤为只包含我需要的那些记录。最重要的是,我想在 Dataview 中获得第一条记录。
//appDV contains a bunch of records with different LOAN_STATUS. Here I'm filtering it by Approved
appDV.RowFilter = "LOAN_STATUS = 'Approved'";
appDV.Sort = "CREATE_TIME DESC";
// If more than one record, take the 1st record
appuser = new AppUserVO();
appuser.APPUSER_ID = Convert.ToInt32(appDV.Table.Rows[0]["APPUSER_ID"].ToString());
appuser.BankLenderId = appDV.Table.Rows[0]["BANK_LENDERID"].ToString().Trim();
AppList.Add(appuser);
return AppList;
上面的代码没有返回正确的行......因为它在应用过滤器之前返回了 DataView 的行。我究竟做错了什么?