Using Select To Locate A Row In A DataTable

  • Thread starter Thread starter Developer Dude
  • Start date Start date
D

Developer Dude

Guest
Hi:

I am using the following code to find an account code for a customer name that is selected using a combobox.

If the customer name includes an apostrophe (single quote), the code produces an error message.


Dim Keys As New List(Of String)
For Each Row As DataRow In dsPSB.Tables("dtCUST").Select("CUST_NAME = '" & cboCUST.Text & "'")
Keys.Add(Row.ItemArray(4).ToString)
MsgBox(CType((Row.ItemArray(4)), String))
Next

End If

Could someone please advise how to prevent this from occurring? Thanks.

Continue reading...
 
Back
Top