开发者

QueryBuilder Modifying Entered Query

Why does QueryBuilder modify my query? Is there a workaround?

When I enter the query below, QueryBuilder modifies the query to the more complex version below, requiring additional parameters for the FillBy method. Any additional parameters adds an exponential amount of complexity to the 开发者_StackOverflowmodified query.

Entered:

SELECT prop, lot, type, created_on, done
  FROM TestSelection
 WHERE (prop=? OR '_NO_PROP_'=?) AND (lot=? OR '_NO_LOT_'=?)

Modified:

SELECT prop, lot, type, created_on, done
FROM   TestSelection
WHERE  (prop = ?) AND (lot = ?) OR
       (prop = ?) AND ('_NO_LOT_' = ?) OR
       (lot = ?) AND ('_NO_PROP_' = ?) OR
       ('_NO_LOT_' = ?) AND ('_NO_PROP_' = ?)

Goal: Allow the user to search by prop, lot, or both. My actual program will query on several additional fields.

Notes:

  • WinForms Project (VB.NET if applicable)
  • TestSelection is a query in a Microsoft Access database


I decided to remove any WHERE conditions in QueryBuilder. Instead, I just use a LINQ query.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜