.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

Searching mobile number

Posted By: kamlesh     Posted Date: January 28, 2011    Points:2   Category :Windows Application
hi,
i am developing one application in C# .net and i have some fields including mobil number and i want to search a mobile .
but i have store the mobile in sequence like (986)258-5896
and when ever i am trying to search mobile number 9862585896 it is not showing me a mobile number iot just give me blank. and when i am searching like 986 so it give me searching result

Thanks ...
Kamlesh

Responses
Author: Faizal             
Posted Date: January 30, 2011     Points: 5   

Hi,

You can use String.Replace() method to remove () or - from the string.

for eg

string strPhoneNo = "(986)258-5896".Replace("(",").Replace(")","").Replace("-","");


Use the above code to remove special character from mobile phone string.



Author: kamlesh             
Posted Date: January 31, 2011     Points: 5   

Thanks

But i have write this quiry
SearchQuery = SearchQuery + " and (MobileTelephoneNumber like '%" + txtContactSearch.Text.Trim() + "%')";

so how it will integrate with ur quiry?

Please Help me.

Thanks
Kamlesh Nikam


Thanks And Regards.
Kamlesh Nikam
Author: SureshM             
Posted Date: January 31, 2011     Points: 5   


Hi,

Use this Query....

SearchQuery = SearchQuery + " and (Replace(Replace(replace(MobileNumber,'#',''),'P',''),'-','')
like '%" + txtContactSearch.Text.Trim() + "%')";



Author: kamlesh             
Posted Date: January 31, 2011     Points: 5   

thanks but it is not working

Thanks And Regards.
Kamlesh Nikam
Author: SureshM             
Posted Date: February 01, 2011     Points: 5   


Use this ....it ll work.. sure..


SearchQuery = SearchQuery + " and (Replace(Replace(replace(MobileTelephoneNumber ,')',''),'(',''),'-','')

like '%" + txtContactSearch.Text.Trim() + "%')";

Author: kamlesh             
Posted Date: February 22, 2011     Points: 5   

Thanks Suresh

but it will Work fine for Full number measn
9874561230 but if i search first four number it will not give me result
means 9874 bcoz it is in (987) 456-1230 this format so how should i search it

help me

Kamlesh

Thanks And Regards.
Kamlesh Nikam


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend