Android Question "Querying the SQLEXPRESS database by time range"

yl0859

Member
"Querying the SQLEXPRESS database by time range" EX: Dim query As String = "SELECT * FROM ALARM WHERE TIME >= '" & daysstart & "' AND TIME <= '" & daysend & "' ORDER BY 报警时间 DESC", i want to ask "What should the format of daysstart and daysend be?"
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

sirjo66

Well-Known Member
Licensed User
Longtime User
Obviously Erel gave you the correct solution, but also you can try this:
B4X:
Dim query As String = "SELECT * FROM ALARM WHERE TIME >= '2024-11-22 07:12:00' AND TIME <= '2024-12-11 08:05:30' ORDER BY 报警时间 DESC"

So, you can understand by self that the format is 'yyyy-MM-dd HH:mm:ss' (string type)
Try it, and then change it into parameterized queries

A little question: with "TIME" do you means date and time or only time of a day ??
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…