Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

How do i update columns in visual basic based on hour and minutes

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
columns: MT1.....MT48

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.

0
vmandem
Asked:
vmandem
1 Solution
 
Anthony PerkinsCommented:
Despite repeated reminders from EE Moderators you refuse top maintain your open questions:

How to transfer this string to a sql server table using bcp Date: 02/15/2002 12:05PM PST  
http://www.experts-exchange.com/jsp/qShow.jsp?ta=mssql&qid=20267423
What is the best way to transfer a txt file with data into sqlserver database table Date: 01/31/2002 02:24PM PST  
http://www.experts-exchange.com/jsp/qShow.jsp?ta=mssql&qid=20261802
How to compare the whole string to the sql row in VB Date: 03/26/2002 07:06AM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20281637
Damienm Could you please  answer my comment How to reposition a single character in a string using VB
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20274463
How to validate the date from table1 and inserting into table2 using VB Date: 02/26/2002 08:28AM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20271212
XML Parse error, status code 80 Date: 06/26/2001 01:49PM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20141976
This question is for chandukb this is again me and this one is different question posted on jun 19th
at 5:OO P.M, Date: 06/18/2001 07:29PM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20137649
How to add a new element to an XSL sytle sheet Date: 03/04/2002 05:32PM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=xml&qid=20273247
XML Parse error, status code 80 in my XML file Date: 06/26/2001 04:58PM PST  
http://www.experts-exchange.com/jsp/qShow.jsp?ta=xml&qid=20142028

Anthony















0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now