2 Replies - 163 Views - Last Post: 06 February 2018 - 09:57 AM Rate Topic: -----

#1 dimdim80  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 102
  • Joined: 28-December 08

DISPLAY RECORDS FROM MYSQL MATCHING FIRST LETTER

Posted 06 February 2018 - 09:49 AM

Dear all,
i have one richtextbox and a datagrid in which i am trying to display the records that are being matched by the string i enter in richtextbox.

 query = "SELECT *  FROM  customer WHERE name LIKE '%" & Me.RichTextBox34.Text & "%'"  


The problem with this code is that it will return all the records which include the characters in the richtextbox.I want for example if i type 'a' to return to me the records in which the first letter is 'a'. or if i type 'ab' then respectively those with these two first letters.

This post has been edited by dimdim80: 06 February 2018 - 09:54 AM


Is This A Good Question/Topic? 0
  • +

Replies To: DISPLAY RECORDS FROM MYSQL MATCHING FIRST LETTER

#2 dimdim80  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 102
  • Joined: 28-December 08

Re: DISPLAY RECORDS FROM MYSQL MATCHING FIRST LETTER

Posted 06 February 2018 - 09:55 AM

SOLUTION: I HAD TO REMOVE THE & FROM THE BEGINNING...
Topic closed
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13776
  • View blog
  • Posts: 54,972
  • Joined: 12-June 08

Re: DISPLAY RECORDS FROM MYSQL MATCHING FIRST LETTER

Posted 06 February 2018 - 09:57 AM

The % is 'any character', right?

So if you have '%foo%' it looks for any string with zero to many characters before foo, and zero to many characters after foo.

If you want only to search for foo followed by zero to many characters which part of that should you remove?

Guess you got it while writing it up.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1