hello,i have one application in vb net where i have 2 datetimepickers and one button and one datagrid.
When i press the button a sub is called(below) and it is supposed to take the datetimepicker1.text and datetimepicker2.text and display the existinf records between these dates .The column that stores the date(called-imerominia) is in varchar format.
Public Sub apo()
conn()
Try
Dim query As String = Nothing
mysqlconn = New MySqlConnection
mysqlconn.Open()
query = "Select * from patient where = imerominia BETWEEN >='" & DateTimePicker1.Value & "'AND imerominia <='" & DateTimePicker2.Value & " '"
Dim querycomcheck As New MySqlCommand(query, mysqlconn)
While reader.Read
Dim imerominia As String = reader.GetString("imerominia")
Dim imerominia1 As String = reader.GetString("imerominia")
DateTimePicker1.Text = (imerominia)
DateTimePicker2.Text = (imerominia1)
End While
sda.Fill(dbdataset)
bsource.DataSource = dbdataset
DataGridView1.DataSource = bsource
sda.Update(dbdataset)
reader = querycomcheck.ExecuteReader
Catch ex As Exception
MessageBox.Show("nothing")
End Try
End Sub
When executing it nothing is displayed.I have tried instead of datetimepicker.text to enter datetimepicker.value as well as to change in my datatbase the format of the column from varchar to date or datetime but again it skips off the query section and displays nothing.
The same thing but when searching only from one datetimepicker and not between the range ,WORKS perfectly..
I have been searching and testing many things and i am totally confused,any help would be really appeciated.