|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Looping through Datasetstats. The problem I have is when I modify a row of data, it counts that row 3 times the next time i run the loop. I believe it has something to do with the way datasets keep track of changes. For Each row As DataRow In CustomerDataSet.Tables(0).Rows Dim dtRedeemed As DateTime Dim intLocation As Integer If Not row("RedeemedOn") Is DBNull.Value Then dtRedeemed = CDate(row("RedeemedOn")) End If If Not row("LocationID") Is DBNull.Value Then intLocation = CStr(row("LocationID")) End If If intLocation = LocationID Then iTotal += 1 If dtRedeemed.Date = Now.Date Then iToday += 1 End If End If Next Be sure to call CustomerDataSet.AcceptChanges
T Charlie Brown wrote: Show quoteHide quote >I am using the code below to loop through a dataset for reporting >stats. The problem I have is when I modify a row of data, it counts >that row 3 times the next time i run the loop. I believe it has >something to do with the way datasets keep track of changes. > > For Each row As DataRow In CustomerDataSet.Tables(0).Rows > Dim dtRedeemed As DateTime > Dim intLocation As Integer > If Not row("RedeemedOn") Is DBNull.Value Then > dtRedeemed = CDate(row("RedeemedOn")) > End If > If Not row("LocationID") Is DBNull.Value Then > intLocation = CStr(row("LocationID")) > End If > > If intLocation = LocationID Then > iTotal += 1 > If dtRedeemed.Date = Now.Date Then > iToday += 1 > End If > End If > Next > > >
Porting VB6 to .Net - DDE replacement?
scope of command and garbage collection Binding currencyManager and dataRelation - datagridview - possible Object from variable text align Need help with Conversion from C# to VB.net SET ARITHABORT ON: Why (not)? Web Service Question about a conversion project Inline SQL vs stored procs on SQL Server 7 and 2000 |
|||||||||||||||||||||||