I have an application which tracks numbers throughout a given timespan. In this example, I have two tables. One table is a result of a SQL statement. It includes 2 columns: a number and a time. The other table is a contains 2 columns. One of which is a time flow ranging from 8am to 5pm by 1 minute increments. The other column in this table is used to insert the "Number" value of the first table (adding values when multiple numbers are for the same minute). The second table is used to create the background table of a graph.
Right now, I am simply using For Each statements to populate the second table from the first table. I add some logic in to reduce the amount of loops once the times match and the value is inserted/added.
Is there a better way to insert this data? Is there a way to create a datarelation between the Time value column of the SQL result table and the Time value column of my 2nd table which runs 8am to 5pm (by minute)....then do a mass insert??? I'm looking for a way to reduce the time this takes. Of course, my example is dumbed down for the interest of simplicity. The real "2nd table" has a longer span than 8am to 5pm and repeats this process 4-6 times. THEN...the entire process is repeated once per 60-90 seconds to update the graph.
'Something like this.
For Each Row as System.Data.DataRow in DS.Tables("SQL_Result").Rows
For Each Row1 as System.Data.DataRow in DS.Tables("TimeTable").Rows
If Row.Item("Time") = Row1.Item("Time") Then
Row1.Item("Number") += Row.Item("Number")