0

I have a line of code that pulls some data. I need to use wildcard starting with. for the both name and surname area but couldn't be able to work this out.

code: CustomerDataGridView.DataSource = Me.CFSDataSet.Customer.Select("name LIKE'" & nmtxt.Text & "'AND surname LIKE'" & sntxt.Text & "'")

this returns both name and surname at the same time exaclty same as in the name and surname area but i need both areas return values those are starting with the textboxes. e.g John Doe Jo for the name and Do for the surname and it must return the complete name and surname. Thanks.

  • I think you're asking this: [Microsoft Jet wildcards: asterisk or percentage sign?](http://stackoverflow.com/q/719115/1115360). Note that you should use parameters to pass the values to the query - if someone searches for a surname of "O'Rourke" then your query will break. – Andrew Morton Dec 18 '15 at 19:22
  • CustomerDataGridView.DataSource = Me.CFSDataSet.Customer.Select("name='" & nmtxt.Text & "'AND surname=" & sntxt.Text & "'") this is for the exact name and surname sir. name and surname areas known as strings by the user. But i just cant implement the including with functionalty to the code. – Barış Taşyürek Dec 18 '15 at 20:14
  • You have to put the wildcard character in, for example `nmtxt.Text & "%"`. – Andrew Morton Dec 20 '15 at 14:35

0 Answers0