|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataViewRowState filter not workingmodified value, using the DataViewRowState filter. However, both the original value and the new value are returning the new value. Can anyone figure out what I am doing wrong? Here is the code: rowsOriginal = DsVendors1.TBL_VENDORS.Select("", "", DataViewRowState.ModifiedOriginal) rowsCurrent = DsVendors1.TBL_VENDORS.Select("", "", DataViewRowState.ModifiedCurrent) daVendors.Update(DsVendors1, "AP_TBL_VENDORS") I put in the last line of code to show you that I am not calling the Update until after I set the rows. I know calling the Update would call AcceptChanges and then I would not have any Modified rows at all. I am changing a value in the TBL_Vendors, but when I check that value in rowsOriginal and rowsCurrent, they both return the new value. I know I have Modified rows because the rowsOriginal.Length and rowsCurrent.Length are both =1. Can anyone help? I am not sure what it is you are trying to do, or even what your code is
doing. There is only ever one set of rows. Your variables may have pointers to a subset of those rows, but they are not copies of those rows. There is only ever one set of them - and both the dataset and the variables you have point to the same thing. So, if a row because Unmodified in the dataset, it will in the variable you are using to hold to on to a subset as well. Maybe this isn't the issue, but I really couldn't follow what you were doing here, or what you were checking after the Update and what kind of results you were looking for. "CNHS" <cnhs2***@verizon.net> wrote in message news:u442h.16479$DH5.7961@trnddc04...Show quote >I am trying to compare the original value of a specified column to its new >modified value, using the DataViewRowState filter. However, both the >original value and the new value are returning the new value. Can anyone >figure out what I am doing wrong? > > Here is the code: > rowsOriginal = DsVendors1.TBL_VENDORS.Select("", "", > DataViewRowState.ModifiedOriginal) > rowsCurrent = DsVendors1.TBL_VENDORS.Select("", "", > DataViewRowState.ModifiedCurrent) > > daVendors.Update(DsVendors1, "AP_TBL_VENDORS") > > I put in the last line of code to show you that I am not calling the > Update until after I set the rows. I know calling the Update would call > AcceptChanges and then I would not have any Modified rows at all. I am > changing a value in the TBL_Vendors, but when I check that value in > rowsOriginal and rowsCurrent, they both return the new value. I know I > have Modified rows because the rowsOriginal.Length and rowsCurrent.Length > are both =1. > > Can anyone help? > > Hi,
"CNHS" <cnhs2***@verizon.net> wrote in message news:u442h.16479$DH5.7961@trnddc04...Show quote >I am trying to compare the original value of a specified column to its new DataTable.Select returns an array of DataRows. A modified DataRow always >modified value, using the DataViewRowState filter. However, both the >original value and the new value are returning the new value. Can anyone >figure out what I am doing wrong? > > Here is the code: > rowsOriginal = DsVendors1.TBL_VENDORS.Select("", "", > DataViewRowState.ModifiedOriginal) > rowsCurrent = DsVendors1.TBL_VENDORS.Select("", "", > DataViewRowState.ModifiedCurrent) > > daVendors.Update(DsVendors1, "AP_TBL_VENDORS") > > I put in the last line of code to show you that I am not calling the > Update until after I set the rows. I know calling the Update would call > AcceptChanges and then I would not have any Modified rows at all. I am > changing a value in the TBL_Vendors, but when I check that value in > rowsOriginal and rowsCurrent, they both return the new value. I know I > have Modified rows because the rowsOriginal.Length and rowsCurrent.Length > are both =1. > > Can anyone help? > contains both old and new values, you have to use the overloaded indexer to get the old value: oldValue = DsVendors1.TBL_VENDORS[rowIdx][colName, DataRowVersion.Original]; The DataViewRowState enum is also available on DataView.RowStateFilter where it has more effect since the DataRowView's only expose one version of data. HTH, Greertings Show quote > |
|||||||||||||||||||||||