I use a dataset file in a win-form C# project.this query works well but unfurtonately, when I use it within a table adapter query builder, I see an error message "Wrong parameter":SELECT EntryID, UserInfo, Kind, ActionDate, Span, SalaryAtActionFROM LogbookWHERE ((CASE WHEN @Enter = 0 AND @Exit = 0 THEN 0 WHEN @Enter = 1 AND @Exit = 0 AND kind = '?????' THEN 1 WHEN @Enter = 0 AND @Exit = 1 AND kind = '?????' THEN 1 WHEN @Enter = 1 AND @exit = 1 AND kind IN ('?????', '?????') THEN 1 ELSE 0 END) = 1)the problem is not in the sql syntax but in the table adapter.you may either know about another various of this query or know to play with the table adapter.notice that I use ssceShimi