Click here to Skip to main content
15,559,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:

VB
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:

VB
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 20:25pm
v2
Comments
Sergey Alexandrovich Kryukov 4-Jan-12 1:21am    
Why is this a problem? Never tried? Try to develop this method and ask a question if you have any difficulty.
--SA

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.
 
Share this answer
 
This Code may help you
C#
string Data = TextBox1.Text;
Data = Data.Replace("\"", "");
TextBox1.Text = Data;

imagine TextBox1.Text is data from database
 
Share this answer
 
v2
Try This one :
VB
Dim S As String = "Your String"
S = S.Remove("'")

I hope it will help you. :)
 
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