I have a complex select
statement for an Access 2010 database which grabs data from multiple tables using several LEFT JOIN
statements. The query works as expected and I get the entire table.
So now I want to add search functionality.
One way was to add a WHERE
clause at the end of the query and reference one of the JOIN
ed tables' text field and compare it against some text (WHERE [All Names].Name LIKE "*Mark*"
).
Second option I tried was select * from (**complex sql here**) where **condition**
Now in both cases, when my condition is something simple like ([ID]<15)
, it works like a charm, but when I change it to ([Employee Name] LIKE "\*Mark\*")
or the one in option 1, it produces an empty data table as if the request goes through, there is no error or exception, all the field names are present, but no rows are returned.
However, if I grab the full string of the generated SQL string (either option) using the debugger (or just dump it into a text file), and then with literally no changes put that string directly into a new Access query, it works fine and returns several fields where the name contains "Mark"
Very simply put, a query that works fine within Access, does not work from within C#.
So I am now confused