In common sense, from_datetime should be before to_datetime, your code defies this:
from_time >= getdate() and to_time<=getdate()
re-examine your logic.
In fact, you can simply do this:
SELECT * FROM tablename WHERE getdate() BETWEEN from_datetime AND to_datetime