Basically what I'm trying to do is - subtract a time field in my record from my system time for each record. Business Days Only
example
order NO__Name ___Req_date ___Days late (Dynamic Column for Calc Results)
11111_____ Test ___8/17/2007 ________4
11112_____ Test2 ___8/15/2007 _______6
Days Late is a dynamic column
I need to do this for each record - and I can not get my loop to work - when it loops it I only get the calculation for the first record and it puts that calculation in every record for days late
This is my Code - What am I missing? How do I get it to go to next record - I've changed the code around so much - that nothing makes sense any more - Help will be appreciated
example
order NO__Name ___Req_date ___Days late (Dynamic Column for Calc Results)
11111_____ Test ___8/17/2007 ________4
11112_____ Test2 ___8/15/2007 _______6
Days Late is a dynamic column
I need to do this for each record - and I can not get my loop to work - when it loops it I only get the calculation for the first record and it puts that calculation in every record for days late
This is my Code - What am I missing? How do I get it to go to next record - I've changed the code around so much - that nothing makes sense any more - Help will be appreciated
Code:
Dim dt1 As New DataTable
Dim rw As DataRow
dt1 = MyDataSet.Tables(0)
For Each rw In dt1.Rows
' Console.WriteLine(rw("Days Late"))
Select Case DatePart("w", d1)
Case 1
subtract = subtract + 1
Case 7
subtract = subtract + 2
End Select
Select Case DatePart("w", d2)
Case 1
subtract = subtract + 2
Case 7
subtract = subtract + 1
End Select
absday = DateDiff("d", d1, d2) + 1 - subtract
fncGetDays = absday - CInt(2 * (absday \ 7))
If fncGetDays < 0 Then fncGetDays = 0
Next rw