BRSinh
BRSinh

Reputation: 268

Remove Special Character From Mysql Data At Search Time

I have mysql table which have stored data in One Column like this

Table12

column1
_______
234_126
6711_12
61_1256
9009_21
34_0979

Where place of "_" is not fixed But Suppose i have to search 611256 from that table (which is 3rd row) so how can i achieve this at runtime ? I don't have to replace these special character in table i just want to achieve at just runtime . . . . .

Upvotes: 0

Views: 169

Answers (2)

rayncorg
rayncorg

Reputation: 993

or try this. let just say you have a textbox lets call it txtsearch then in dataadapter use SELECT STATEMENT like this:

dim myDA as new Mylsqldataadapter("SELECT * FROM tablename WHERE Column1 LIKE '" & txtSearch.text.trim.replace("_","") & "%'",connectionStr)

Upvotes: 0

naveen goyal
naveen goyal

Reputation: 4629

Try This...for more http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace

SELECT * from tablename where REPLACE(column1, "_","") = 611256 

Upvotes: 4

Related Questions