I need to create a daily report where my inputs in the database will show in a chart.
Database name: restoDB
table name: tlreports
fields:
ReportID- int
Amount - decimal
Date - datetime
I need to display the current date and time also the amount of sales every hour.
This is my code but it shows all the inputs from all of the dates stored on my database:
Public Sub LoadChart()
Dim con As New MY_CONNECTION
Dim Reader As MySqlDataReader
Dim commanddate = New MySqlCommand("select * from tlreports ", con.getConnection())
Dim datetime = Val(txtboxDateTime.Text)
commanddate.Parameters.Add("@datetime", MySqlDbType.VarChar).Value = datetime
con.openConnection()
Reader = commanddate.ExecuteReader
While Reader.Read
chrtDaily.Series("Daily Income").Points.AddXY(Reader.GetDateTime("Date"), Reader.GetDecimal("Amount"))
End While
con.closeConnection()
End Sub