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

Recommended Answers

All 3 Replies

You can use a query like this:

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

ok i will try it...tq

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.