Tuesday, March 27, 2012

DataTable.select method

helloo

Can I use "like" in datatable.select method?

meaning:

Dim exp As String = "c.cDesc like " & txtSearch.Text & " + N'%' "
Dim rows() As DataRow = dtCenters.Select(exp)

knowing that txtSearch.text has unicode characters

Yes. However, your expression does not include quotes so you are probably not sending what you think you are sending.

Dim exp As String = "c.cDesc like '" & txtSearch.Text & "' + N'%' "

The better option is to use a parameter and set the value of the parameter to your textbox.

sql