Search between two dates

  • Thread starter Thread starter ahmeddc
  • Start date Start date
A

ahmeddc

Guest
HI


I want to search between two dates in the database
Problem with the following code I want to arrange the date after the search ascending
This code works well if the date is not arranged " ORDER BY TYPY_DATE "

Dim day As Date = DATETIM_START.Text
Dim a, b As String
a = DATETIM_START.Text
a = Format(day, "MM/dd/yyyy")


Dim sday As Date = DATETIM_END.Text
b = DATETIM_END.Text
b = Format(sday, "MM/dd/yyyy")

'WORK CODE
Dim DataAdapter As New OleDbDataAdapter("SELECT TYPY_ID,TYPY_CODE,TYPY_MONY,TYPY_PRICE,TYPY_DATE FROM TYPY_TB WHERE TYPY_DATE >= #" & a & "# And TYPY_DATE < #" & b & "#", con)

'NOT WORK CODE
' Dim DataAdapter As New OleDbDataAdapter("SELECT TYPY_ID,TYPY_CODE,TYPY_MONY,TYPY_PRICE,TYPY_DATE FROM TYPY_TB WHERE TYPY_DATE >= #" & a & "# And TYPY_DATE < #" & b & "# ORDER BY TYPY_DATE", con)

'NOT WORK CODE
' Dim DataAdapter As New OleDbDataAdapter("SELECT TYPY_ID,TYPY_CODE,TYPY_MONY,TYPY_PRICE,TYPY_DATE FROM TYPY_TB WHERE TYPY_DATE >= #" & a & "# And TYPY_DATE < #" & b & "#""ORDER BY TYPY_DATE", con)

Continue reading...
 
Back
Top