Search results

  1. L

    Question How to Group and Sum datatable

    Tanx jmcilhinney for your advice. And tanx Herman for your suggestion. I study the code again through all night, tested all possible solution and got it solved. Finally, i used LINQ to perform the group and summation and it works. Tanx all for your support :)
  2. L

    Question How to Group and Sum datatable

    Tanx Herman! but since i'm at home right now, i'll try as your suggested tomorrow. Tanx again! :)
  3. L

    Question How to Group and Sum datatable

    sir, can you please show me the example on how to loop through the rows and add the data to a Dictionary? What am i confused is, in the first step in post #2 which is to loop through the rows and add the data to a Dictionary , i should declare the type of DURATION as what? if you refer to #7...
  4. L

    Question How to Group and Sum datatable

    Or maybe i should use FOR EACH selected LINE, i sum the DURATION for the line and loop it to the next LINE? but i'm not sure how to do the loop to get each line and sum the DURATION by LINE.
  5. L

    Question How to Group and Sum datatable

    I know how to do the conversion from string to timespan type and sum it in vb. The problem is, i got the total of summation for the whole of DURATION column. Not sum by group (LINE). Do you have any idea how i can sum it by group?
  6. L

    Question How to Group and Sum datatable

    ok. So first i dont have to convert the DURATION of type Char to timespan? I just insert straight from database to the dataset without converting it? Is that so? Sir, can you please show example please...
  7. L

    Question How to Group and Sum datatable

    Now i'm trying to do the Dictionary method and get error "an item with the same key has already been added" Here is the code: Dim dct As New Dictionary (Of String, String) For each r As Datarow In Ds.Tables(0).Rows dct.Add(r.Item(1).ToString(), r.Item(0).ToString()) Next Another...
  8. L

    Question How to Group and Sum datatable

    So I have to use the DICTIONARY method? is it possible to sum the timespan datatype if i use DICTIONARY?
  9. L

    Question How to Group and Sum datatable

    jmcilhinney, tanx for your reply. However, I'm not familiar with DICTIONARY and have tried doing the summation using LINQ (just learn about LINQ yesterday). So far here is what i've done: Dim totalSum As Datatable = Ds.Table(0) Dim query = _ From s In totalSum.AsEnumerable() _ Let line =...
  10. L

    Question How to Group and Sum datatable

    Hi, i'm a newbie and get stuck with this problem for a few days. I have datatable with two column, line and duration. I want to sum the duration based on the line group. For example: LINE DURATION A1 00:05:20 A1 00:07:00 A1 00:02:10 A1 00:01:50 A2 00:02:01 A2 00:03:45...
Top Bottom