Last post Jun 07, 2018 12:18 PM by PatriceSc
Jun 06, 2018 01:58 PM|Nighthawk0712|LINK
I am having trouble with my Sqldatasource with using OR statements in the Where Clause. It will not work using the OR. Below is my sql statement:
SELECT [OSVer], [DiskFree], [DiskSize], [MemorySize], [Asset], [IPAddress], [LoggedOnUser], [RPTSendTime]
WHERE (([LoggedOnUser] = @LoggedOnUser) or ([MachineName] = @MachineName) and ([RptSendTime] between (@RptSendTime) AND (@RptSendTime2)))
Order by RPTSendTime
Any help would be greatly appreciated.
Jun 06, 2018 02:35 PM|PatriceSc|LINK
That is ? Do you have an error message or the query just doesn't return any row at all? I would test the query in my database with the same values to see how it behaves. Are you 100% sure this query runs with the expected values ?
For example user names and machine names are normalized to always include (or exclude if you prefer) the domain name ???
If you still can't find trhe problem, simplify the query to find which criteria is causing your query to return no result at all.
Jun 06, 2018 09:14 PM|oned_gk|LINK
WHERE ([LoggedOnUser] = @LoggedOnUser or [MachineName] = @MachineName) and [RptSendTime] between @RptSendTime) AND @RptSendTime2
Jun 07, 2018 12:08 PM|Nighthawk0712|LINK
Thank you oned_gk. That worked. I appreciate your help.
Jun 07, 2018 12:18 PM|PatriceSc|LINK
Ah great. I missed it was just a parenthesis issue. I would suggest to not use more parenthesis than needed for clarity.