Filter-expression

Hello,

I will select DataRow from DataTable,
but my filter-expression is not OK.

myDataTable.Select("place = 'La Tour d'Auvergne'");

That does not work, because place includes the apostrophe.

What can I do

Please, help me.


Answer this question

Filter-expression

  • JochenS

    Thanks,
    that was helpful.

  • KBeBo

    Dim Criteria as string =" 'La Tour d'Auvergne' "


    myDataTable.Select("place =" & Criteria);



  • njohe

    Or

    "place =" & ControlChars.Quote & "La Tour d'Auvergne" & ControlChars.Quote


    I would use the quotes vs the apostrophe just to make sure!!!

  • Pavel S. Kozlov

    Replace the single apostrophe in the value with two apostrophes (not a single double-quote character):

    "place = 'La Tour d''Auvergne'"

    This is the same syntax that most databases use in queries.

    I hope this information proves helpful.

    David Sceppa

    ADO.NET Program Manager

    Microsoft



  • Filter-expression