Hello Friends,
I am messed up with the below query
Try
Dim myCommand As OleDbCommand
myCommand = New OleDbCommand("select sum(tmt.total) as Total from Appointment appt, TreatmentMaster tmt where appt.patientid='" + txtPatIDBill.Text + "' and [tmt].[treatid]=[appt].[treatmentid] and (Format([appt.ApptDate], 'Short Date')) between '" + dtpFromBill.Value.Date + "' and '" + dtpToBill.Value.Date + "'", Connection)
Dim reader As OleDbDataReader = myCommand.ExecuteReader
Debug.Print("Query output: " + myCommand.CommandText)
If reader.Read = True Then
Debug.Print("True")
Else
Debug.Print("False")
End If
Catch ex As Exception
MsgBox("Error Connecting to Database: " & ex.Message)
End Try
I have to select the patientid, from date and the to date from the GUI part....
I have values in Database for date 2/20/2012 and 2/22/2012
whenever I try to run the query in Access it is returning the correct data...
but when i run the query in my project the reader in not reading correctly...even if values are present is returns false
and if values are not there then it returns true....
I am not getting where I am going wrong...
Please help me...