locked
Entitydatasource filter with IN clause RRS feed

  • Question

  • User-867857476 posted

    hello guys,

    i want to filter Entitydatasource  by a list of number but i got this error

    The query syntax is not valid. Near term ',', line 6, column 48.

    what is wrong with this code?

    BookEntityDataSource.Where="it.CategoryId_FK=@Cat||it.CategoryId_FK IN (1,3,11,8,6,7,10,95,4,5)";

    Friday, November 14, 2014 12:47 PM

Answers

  • User-158764254 posted

    try swapping your parenthesis to curly braces

    it.CategoryId_FK IN {1,3,11,8,6,7,10,95,4,5}
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, December 21, 2014 10:00 AM

All replies

  • User-1538479794 posted

    Hi

    The query syntax is not valid. Near term ',', line 6, column 48.

    That is because that you sql statement has some exception

    so please try to chang || to or as follow code :

     BookEntityDataSource.Where = "it.CategoryId_FK=@Cat"+"or"+"it.CategoryId_FK IN (1,3,11,8,6,7,10,95,4,5)";

    Best Regards,

    May

    Sunday, November 16, 2014 10:20 PM
  • User-867857476 posted

    thanks May-song, i try your answer but i still get "The query syntax is not valid. Near term ',', line 6, column 48" error

    Thursday, December 11, 2014 4:03 PM
  • User-867857476 posted

    any body?

    Sunday, December 14, 2014 2:16 PM
  • User-158764254 posted

    try swapping your parenthesis to curly braces

    it.CategoryId_FK IN {1,3,11,8,6,7,10,95,4,5}
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, December 21, 2014 10:00 AM