how can i get the value accumulated from the date i select from datetimepicker1 to datetimepicker2 in vb.net and mysql? the value here refers to the daily sales and i need to find the total sales between the range dates that i choose..
please help me..as im beginner and my knowledge is limited..
thanks in advance..
You didnt say exactly where from, so I will assume from database.
You can write an sql query that will look like:
Dim sqlQuery As String = "SELECT * FROM MyTable WHERE DateColumn >= @param1 AND DateColumn <= @param2"
'by using sqlcommand you then define parameters:
cmd.Parameters.Add("@param1", SqlDbType.DateTime).Value = datetimepicker1.Value
cmd.Parameters.Add("@param2", SqlDbType.DateTime).Value = datetimepicker2.Value
thank you very much to both mitja and jim!!
but there's a problem here , when i select the date retrieving from database from start date to end date, there's an error displaying the result to my listview, where for eg, when i choose dates from 01/10/2011 to 31/10/2011, the result display 3 rows result where i only have 2 results in my database.. is there any problem with my code??
Dim result As MySqlDataReader
result = Nothing
Dim cmd2 As New MySqlCommand
conn = New MySqlConnection("Server = " + _host + ";User ID = " + _user + ";Password = " + _pass + ";database = transportation")
.CommandText = "SELECT * FROM driversearned WHERE DateTP >= @dt1 AND DateTP <= @dt2"
.Connection = conn
result = cmd2.ExecuteReader
.FullRowSelect = True
.View = View.Details
.GridLines = True
.Sorting = Windows.Forms.SortOrder.Ascending
.Columns.Add("DriversName", 140, HorizontalAlignment.Left)
.Columns.Add("Charges", 140, HorizontalAlignment.Left)
Do While result.Read
drvname = result.GetString(result.GetOrdinal("DriversName"))
comm = result.GetString(result.GetOrdinal("Charges"))
NewItem = New ListViewItem(drvname)
count = count + 1
I Developed application in C# with crystal reports and created setup file in third party (Advance) Installer.When i installed my application on client system application is working but ...