Solved

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

Posted on 2002-06-18
1
134 Views
Last Modified: 2010-05-03
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
Comment
Question by:vmandem
1 Comment
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 60 total points
ID: 7091644
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now