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.

[338 byte] By [bagira] at [2007-12-16]
# 1
Dim Criteria as string =" 'La Tour d'Auvergne' "
myDataTable.Select("place =" & Criteria);
DMan1 at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...
# 2
Or

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


I would use the quotes vs the apostrophe just to make sure!!!
DMan1 at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...
# 3

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

DavidSceppa at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...
# 4
Thanks,
that was helpful.
bagira at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...

.NET Development

Site Classified