How do i update columns in visual basic based on hour and minutes
Posted on 2002-06-18
I have a row like this in my table table1
Column Names: col1 col2, col3 col4 col5 MT1 MT2.......MT48
PBH, 1, 00000015, 07, 200206180630,, 27,,, 28,,,28,,,27,,,28,,,27,,,27,
If you observe the col5 it is date and time like this: 2002/06/18 06:30 AM
Based on col4 count i get the readings starting from MT1....MT48. In above case i got count:7
and so i got MT1 AND MT7 readings.
The row inserted at 6:30 AM
I get a second string like this from a different source:
PBH, 1, 00000015, 02, 200206180800,, 27,,,29,
If you observe the col5 column it is date and time like this: 2002/06/18 08:00 AM
Before updating the above string into the table1
I want to compare the first row hour and second string hour and i want to update the
some what tricky right, i will tell in detail what i want:
If you take the first row it started at 6:30 AM and count is:7, so it goes and fills from
MT1 to MT7 and my time increments by 15 minute interval, so MT1-->6:30 AM, MT2-->6:45 Am
and so on.. MT7-->8:00 AM
Now if you take second string it started at 8:00 AM and count is:2. Now based on time
it started at 8:00 AM it should skip MT7 because the second string started at 8:00 AM and
there is an overlap of reading and the table must update from MT8-->which will be 8:15 AM
and reading is 29 from second string
so if you observe MT1 reading(27) in first row and second string first value(27)it is same and it is an overlap
of the reading and i want to update the row based on hour from MT8-->8:15 AM with value 29.
so the above scenario is just an example but in real world i get different counts and
different times and i want to apply the same logic for all the cases. How do i do that
in visual basic.
In simple terms i can say i want to update the table based on hour and avoid the duplicate
update if the row already have a value in that hour when compare to second string hour.