Hy, I need a help on this, I have a datagridview with several columns, but what I´m trying to do is sum km2 column based on date. I´m using the following code:
The query is grouping by DATE (data), this OK, but the km2_FF values not, is not showing anything. Do you guys have a different solution or to fix this one?Code:Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.CadastroSeqTableAdapter.Fill(Me.Db01DataSet.CadastroSeq) Dim con As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\db01.mdb") Dim ds As New DataSet Dim da As OleDb.OleDbDataAdapter Dim sql As String sql = "SELECT Data, Sum(Km2_FF) FROM CadastroSeq GROUP BY Data" da = New OleDbDataAdapter(sql, con) Dim dt As New DataTable("CadastroSeq") da.Fill(dt) CadastroSeqDataGridView.DataSource = dt End Sub
To be more clearer, this datagridview has different values of km2_FF for the same date, I want to display the total of km2_FF for each day.
Thanks.




Reply With Quote
