hi. i'm trying to setup a page which will allow user to search events by date. i have a regular html page which will pass the information to my asp page. my where clause looks like this but it will not work:
WHERE DefendantCharge.SentenceDispositionDate LIKE '%" & Request.Form("Date") & "%'
well, SQL Server does not require a statement terminator, the SQL statement ends after the last word in the statement, so i guess i will have to give way to someone more knowledgeable, because i don't know either classic asp or dot net, and it sounds like that's where your problem is now
the only reason i thought i could help is because it sounded like an SQL problem
you can verify whether the SQL works by running it in Query Analyzer
what this will do is convert the date over to YYYYMMDD format. As long as you are not worried about time this should work. Also, if you have to do a range of dates, this particular format will sort properly.
If you still get an error, do a response.write(sqlstring) of the select string before sending it to be executed. Post that string and we can better help you out.
strSQL = "SELECT DefendantCharge.SentenceDispositionDate, DefendantCase.LabNo, DefendantCase.FirstName, DefendantCase.MiddleName, DefendantCase.LastName, PubDefDescription.[Description] AS PubDef, DefendantCharge.ChargeCount, DispositionDescription.[Description] AS Disposition, DefendantCharge.SentenceNotes FROM DefendantCase JOIN DefendantCharge ON DefendantCharge.VBKey=DefendantCase.VBKey LEFT JOIN DispositionDescription ON DefendantCharge.SentenceDisposition=DispositionDescription.DispositionID LEFT JOIN PubDefDescription ON PubDefDescription.PubDefID=DefendantCase.PubDefID WHERE Convert(char(8), DefendantCharge.SentenceDispositionDate, 112) = convert(char(8), " & Request.Form("Date") & ",112) ORDER BY DefendantCase.LastName, DefendantCase.FirstName"
it runs the query without any errors; however, it will not pull up any results. i get a blank screen when i know i should have about 30 results. thanks for any help.