Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning a string containing a single Quote 1

Status
Not open for further replies.

globularbob

Programmer
Nov 15, 2002
69
US
Hello

Here is the code:

Response.Write(&quot;<TD><INPUT type=text maxlength=50 name=Desc id=Desc value='&quot; & rsTasks.Fields(&quot;Notes&quot;) & &quot;'></TD>

When the rsTasks.Fields(&quot;Notes&quot;) returns a value with a single quote, such as &quot;Can't do this&quot; the textbox only shows &quot;Can&quot; because it's thinking that the apostrophe is the end of the string. I can submit it to the database just fine, but can't return it the way I want. If I lose the single quote in the response.write, then the first word of the sentence comes back, but nothing else. (example: &quot;Can't&quot;)

Any ideas??

THANKS!!!!!

GB
 
Use double quotes for your values instead of single quotes. A double double quote in ASP is rendered as a single double quote in the string rather than the end or beginning of a new string:
Code:
Response.Write(&quot;<TD><INPUT type=text maxlength=50 name=Desc id=Desc value=&quot;&quot;&quot; & rsTasks.Fields(&quot;Notes&quot;) & &quot;&quot;&quot;></TD>

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
ah-HA! That's what it was!

Thanks alot....it worked for me!

GB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top