Click here to Skip to main content
14,327,443 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi all,

I'm using visual studio 2008. I store a temp data on a string which contain double quote. How should i remove the quote?I get the data from array to store and need to transfer the data to structure before proceeding save into database. I get the data from text file and use streamreader to read the data and put into array.

Example:

strCustInfo=strArray(0) ---- "TRANSPORT "MEDIA" DEPT PVT. LTD"      ---- data appear in array with ""

Is it possible to remove the double qoutes?
If some data has only 1 double quote, is it also can be remove?

Example:

strCustInfo=strArray(1) ---- "SOFTMEDIA D"PT PVT. LTD"      ---- data appear in array with "

I just assume that the data with 1 double quote is problem when download from database.
Posted
Updated 3-Jan-12 19:25pm
v2
Comments
   
Why is this a problem? Never tried? Try to develop this method and ask a question if you have any difficulty.
--SA
Rate this:
Please Sign up or sign in to vote.

Solution 1

If you're using parameters (see: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlparameter.aspx[^]) in your SQL statements, the quotes won't cause problems in your insert, selects etc.

If the user has entered this data, IMO modifying the data is a bad idea. The application should store the information as it is.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

This Code may help you
string Data = TextBox1.Text;
Data = Data.Replace("\"", "");
TextBox1.Text = Data;

imagine TextBox1.Text is data from database
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 3

Try This one :
Dim S As String = "Your String"
S = S.Remove("'")

I hope it will help you. :)
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100