Hello Group. I would like to compare the database dates, with a constructed date, but it doesn’t work.
// Create my date
Dim DataEsaminata as new date
DataEsaminata.Year=2022
DataEsaminata.month =05
DataEsaminata.day=03
'messagebox("Confronto la data di calendario =" + dataesaminata.shortDate)
Var rows As RowSet
dim DataFormattata as new date
Try
rows = db.SelectSQL("SELECT * FROM Promemoria where Data="+dataesaminata.shortDate)
If rows <> Nil Then
For Each row As DatabaseRow In rows
messagebox "Trovata data=" + dataesaminata.shortDate
Next
rows.Close
Se stai eseguendo la query su Access bisogna utilizzare DATEVALUE (sto andando a ricordi)
“SELECT * FROM Promemoria where Data=DATEVALUE(’”+dataesaminata.SQLDate + “’)”
Prova così…
Guys, maybe I understand the problem. If I read the date from the database without formatting it, it comes out as LongDate. So I should be able to format it in the query so that it reads as ShortDate and be able to compare it with the search query. It can be done ?
So, I think this is the problem. I display the short date, but in the DB it is recorded as long / complete … when I enter the comparison date which is short, it does not find it.