Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have search part it has textbox and button. if you write a name in the textbox it goes to database and search names and name list comes under textbox sb.Append(temp).Append(Environment.NewLine);

you select a name line you click the name,name fill in the textbox but like this
'JOHN MARK'

so button click event has database code select from xxx where vvv='"+name+"'

so 'JOHN MARK' this gives me error because ' this character chause this error

how to clean this character from start of name and end of name

'JOHN MARK' JOHN MARK
Posted
Comments
Sergey Alexandrovich Kryukov 8-May-12 15:51pm    
Reason for my vote of 2
It makes very little to no sense doing advanced stuff like ASP.NET development or working with databases before learning very basic techniques and general programming. Asking such questions cannot help, because nobody will ask many thousands of them. Just a waste of time.
--SA

Very simplistic answers:

1: change the db code to be vvv=" + name + "... though this would fail if the name passed didn't have the quotes!

2: "'JOHN MARK'".Replace("'","");

You should be able to work out what you need form this. Perhaps reading through the docs might help.
 
Share this answer
 
Comments
Member-2338430 8-May-12 16:06pm    
replace work why I didnt think THANK YOU
Use RegEx to process any type of string manipulation. Refer the article at: The 30 Minute Regex Tutorial[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900