0

Hi All's, really need your's help regarding this issues. I have one Access Database where the Table = ST , Column =DATE(Datetime),CLICK(Integer). I want to get the total value form CLICK column by Month.I'm already tried with this but cannot :

 Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM ST WHERE [DT]=@DATE  ", con)
        cmd.Parameters.Add(New OleDbParameter("@Date", OleDbType.Date)).Value = Date.Now.Month
        Dim totalSum As Integer
        con.Open()

        Dim sdr As OleDbDataReader = cmd.ExecuteReader()
        For i As Integer = 0 To sdr.Item("CLICK").Rows.Count - 1
            totalSum += sdr.Item("CLICK").Rows(i).Item("CLICK")
        Next

        TextBox2.Text = totalSum.ToString
        con.Close()

Can anyone show me the way ?..tq

2
Contributors
3
Replies
13
Views
3 Years
Discussion Span
Last Post by kerek2
0

You can use a query like this:

SELECT YEAR(dt), MONTH(dt), SUM(click) 
FROM st GROUP BY YEAR(dt), MONTH(dt)
0

Ok that SQL it;s ok,,...another ? , how to display in Chart?..please help me.. tq

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.