i sure somebody went throw it...

yaniv

Well-known member
Joined
Apr 15, 2002
Messages
162
Location
israel
Do you have an idea how to solve the inverted commas (e.g. ") problem, when the user type it into the textbox and you send it to the database (you get a problem with your string). Whats the best way that worked for you?
 
Mutant: I dont think SQL Server has a problem with single " but does have a problem with single . Hes probably using Access?

Anyway to the problem..

You could do a String.Replace("\"", "\"\"") or as mutant suggested, replace it with like so; String.Replace("\"", ""). For SQL Server I usually just do a String.Replace("", "") (replace with two ). Theres also a SQL Server function which will take care of all of this for you, but unfortunately I cant remember what it is off of the top of my head.
 
well, the the problem is indeed the . the String.Replace is just great (Although you have to add it to any text you send and get back from the database.)

thanks
yaniv
 
You should only have to do a String.Replace() on data going into the database. Once its in there it should be stored with single and retrieved with single as well.
 
But. if i want the user to the dounle one - ", and not the single, i should do it twice - to replace it in the way to the database in some other, unused, char, and then to replace it again in the way to the app. the "problem" is that both are very usefull in hebrew so i have to make them usufull for the clinet.
 
Some thing happened to my post, what I meant was:

The string.replace is good if you want to change permanently one char to another, but if you want to keep the char (in the user point of view) then you have to replace it twice, one time when you send it to the database and one when you show it to the user again. Dont you?
 
I dont believe so. Like most other string alteration methods, it should return a string with the changes made and leave the current string in tact. I remember having a problem with this when trying to use String.Trim(), I had to do str = str.Trim(). Little odd IMO but it seems to be the way most methods work.
 
Back
Top