E
Earl
Anyone know why the RowFilter has to be double-escaped? Anticipating names
with apostrophes, a single escape does not provide the proper name to filter
on.
For example, this would cause an exception:
Dim strname As String
strname = txtContact.Text
strname.Replace("'", "''")
dv.RowFilter = "ContactFullName='" + strname + "'"
.... but this would provide the proper filter:
dv.RowFilter = "ContactFullName='"" + strname + ""'"
Note the comma before the double quotes on the inside before the apostrophe
and the double quotes after the apostrophe on the outside.
with apostrophes, a single escape does not provide the proper name to filter
on.
For example, this would cause an exception:
Dim strname As String
strname = txtContact.Text
strname.Replace("'", "''")
dv.RowFilter = "ContactFullName='" + strname + "'"
.... but this would provide the proper filter:
dv.RowFilter = "ContactFullName='"" + strname + ""'"
Note the comma before the double quotes on the inside before the apostrophe
and the double quotes after the apostrophe on the outside.