简体   繁体   中英

How search data from access database using phone number that without masked

I have use this (123) 456-7890 format to search data on access database using winforms and my data was saved in same above format but I want do the search throw winform that allow me to enter 1234567890 then give the search result but I can't able to get it from access query

I have tried remove using access format function on my database but it doesn't work and also I have tried mysql replace query still not working.

here is my select query

Command.CommandText = @"SELECT * FROM PersonalINFO  WHERE (FirstName + ' ' + 
   LastName = '" + search_txt.Text + "') OR (EmailAddress = '" + 
   search_txt.Text + "') OR (Home_Tp = '" + search_txt.Text + 
   "') OR (Cell_Tp = '" + search_txt.Text + "') ";

How do I able to ignore the brackets and dashes in the phone number mask when searching I can't able to create new row that without mask because my data size over thousand I have tried remove using access format function on my database but it doesn't work.

storing masked data is not good and it causes complexity hence logical errors and implementation difficulties. I suggest you to use plain format like 123456789 .

we generally prefer to show masked data inside input field but store it as it is.


On the other hand using concatenated strings in query is very bad practice and it is vulnerable to SQL Injection attacks. Instead you need to use Parameterized Queries

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM