Posted by beakersoft | Posted in dotnet | Posted on 25-01-2009
I have been doing some work on an asp.net project that connects to a db with full text indexing enabled on a text field. We are building the app up so that users can run advanced searches using the info in this filed.
While debugging the app, i came across a problem that i thought i was catching and trapping, but my app seamed to be ignoreing the problem and carrying on running so i was getting some strange results.
I was running some sql similar to this:
SELECT Count(title) as rec_count FROM tbl_text WHERE tbl_text.Title=’WXXX’
AND Contains(tbl_text.page_text, ‘Tax Evasion’ AND ‘Joe Blogs’)
In the sql i had constructed i just had an apostrophe out of place (i know rookie mistake), so the sql was failing to run. Problem was the try/catch loop it was in did’t seem to mind! I got out the sql and ran it in sql advantage, and sure enough i got this error:
Server: Msg 7631, Level 15, State 1, Line 1
Syntax error occurred near ‘Evasion‘. Expected ””’ in search condition ‘Tax Evasion’ AND ‘Joe Blogs’.
So sql advantage managed to trap the error, but the dotnet framework for some reason took no notice of it and carried on running. I got round the problem being checking my record set had rows before trying to use it, but i have no idea why an execption was not rasied in the first place. Anyone any ideas?