replace

S

Shawn

Hi.
I have a form with a couple of text fields where users can enter some data.
The data is stored in an access DB.
the problem is that whenever a user enters " in a textbox some of the text
dissapears.
Example:
If the users writes: I have a 17" LCD for sale
Then this is what is stored in the DB: I have a 17

How can I store the whole text in my DB? Or how can I remove it altogether?
I've tried Replace(myString, chr(34), "-") but that didn't work.

any help is greatly appreciated!

Thanks,
Shawn
 
E

Evertjan.

Shawn wrote on 06 sep 2004 in microsoft.public.inetserver.asp.general:
If the users writes: I have a 17" LCD for sale
Then this is what is stored in the DB: I have a 17

How can I store the whole text in my DB? Or how can I remove it
altogether? I've tried Replace(myString, chr(34), "-") but that didn't
work.

[if we are talking about ASP-vbscript you would have to double the
"doublequote"]

myString = Replace(myString, chr(34), chr(34)&chr(34))

not tested.

Another possiblility is to change it to
a double-acute accent or double-grave accent
 
S

Shawn

unfortunately it didn't work...

Shawn

Evertjan. said:
Shawn wrote on 06 sep 2004 in microsoft.public.inetserver.asp.general:
If the users writes: I have a 17" LCD for sale
Then this is what is stored in the DB: I have a 17

How can I store the whole text in my DB? Or how can I remove it
altogether? I've tried Replace(myString, chr(34), "-") but that didn't
work.

[if we are talking about ASP-vbscript you would have to double the
"doublequote"]

myString = Replace(myString, chr(34), chr(34)&chr(34))

not tested.

Another possiblility is to change it to
a double-acute accent or double-grave accent

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)
 
J

Jeff Cochran

Hi.
I have a form with a couple of text fields where users can enter some data.
The data is stored in an access DB.
the problem is that whenever a user enters " in a textbox some of the text
dissapears.
Example:
If the users writes: I have a 17" LCD for sale
Then this is what is stored in the DB: I have a 17

How can I store the whole text in my DB? Or how can I remove it altogether?
I've tried Replace(myString, chr(34), "-") but that didn't work.

What exactly didn't work?
any help is greatly appreciated!

Replace(myString, ", "")

Jeff
 
E

Evertjan.

Shawn wrote on 06 sep 2004 in microsoft.public.inetserver.asp.general:
Evertjan. said:
Shawn wrote on 06 sep 2004 in
microsoft.public.inetserver.asp.general:
How can I store the whole text in my DB? Or how can I remove it
altogether? I've tried Replace(myString, chr(34), "-") but that
didn't work.

[if we are talking about ASP-vbscript you would have to double the
"doublequote"]

myString = Replace(myString, chr(34), chr(34)&chr(34))

not tested.

Another possiblility is to change it to
a double-acute accent or double-grave accent
unfortunately it didn't work...

[please do not toppost on usenet, topposting corrected]

I gave you 3 possiblilties.

"didn't work" gives nor enough information.

1 Which did you test?
2 How did you test them?
3 Did you test it in an ASP page using vbscript?
3 Could you please test the following:

<%
myString = "this '""' is a doublequote"
myString = Replace(myString, chr(34), "#")
response.write myString
%>

does this return '#'?
 
D

Dave Anderson

Jeff said:
Replace(myString, ", "")

Shouldn't that be Replace(myString, """, """") ?



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
R

Roland Hall

in message : I have a form with a couple of text fields where users can enter some
data.
: The data is stored in an access DB.
: the problem is that whenever a user enters " in a textbox some of the text
: dissapears.
: Example:
: If the users writes: I have a 17" LCD for sale
: Then this is what is stored in the DB: I have a 17
:
: How can I store the whole text in my DB? Or how can I remove it
altogether?
: I've tried Replace(myString, chr(34), "-") but that didn't work.

What exactly does "that didn't work" mean?
You have a logical OR request but then gave a negative result response.

If you want to replace a double quote with a hyphen, then replace(myString,
chr(34), "-") should work. This should also work: replace(myString, """,
"-"). However, not being able to see your code leaves us with the
probability you made an error in your coding.

if myString = I have a 17" LCD for sale
then this:
myString = replace(myString, """, "-")
would result in myString having a value of:
I have a 17- LCD for sale

Perhaps showing relevant code might reveal the error?!

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,268
Latest member
AshliMacin

Latest Threads

Top