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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"space" problem with sql query

Status
Not open for further replies.

threeeights

Technical User
Mar 19, 2002
4
JP
I'd like to pull a record from an Access database and display it in a textbox on an ASP generated page. My problem is that only data up to the first blank space in the field is displayed. I'm new to ASP/SQL so I would really appreciate any advice. The problem doesn't occur if I display the query result without the textbox.
Any ideas?
Ward
 
I'd we willing to look at this with you if you post:
(1) The sql staement that is executed,
(2) The asp code that executes the sql and build the result page, and
(3) The asp output result (probably html?) that shows the code in and around the text box.
bp
 
Thanks for your consideration. Your comments made me realize that this is more an ASP/HTML issue than an SQL question. I'm still stumped so I'm grateful for your time!

(1) The sql staement that is executed:
If Request.QueryString(&quot;ID&quot;) <> &quot;&quot; Then
RecordToEdit = Request.QueryString(&quot;ID&quot;)
SQL = &quot;SELECT * FROM tblVehicles WHERE tblVehicles.ID=&quot; & Request.QueryString(&quot;ID&quot;)
End If

(2) The asp code that executes the sql and build the result page:
<INPUT TYPE=&quot;text&quot; NAME=&quot;txtAddress&quot; SIZE=&quot;50&quot; value=<%=rs.Fields(&quot;Address&quot;)%>>

(3) The asp output result (probably html?):
<FONT SIZE=&quot;2&quot; Face=&quot;Verdana&quot;><B>Address:</B></font><br>
<INPUT TYPE=&quot;text&quot; NAME=&quot;txtAddress&quot; SIZE=&quot;50&quot; value=Brisbane Australia>

The problem is that in the textbox only &quot;Brisbane&quot; appears.
 
Like you, I feel the prob is in ASP/html, but we should rule out the sql statement (just because that's easy to do)

Of course, this will work fine from Query Analyzer, right?
(i.e. you get Brisbane Aust just fine, right?)

select * from tblVehicles
where tblVehicles
Where ID = <whatever>
 
>>(2) The asp code that executes the
>>sql and build the result page:
<INPUT TYPE=&quot;text&quot; NAME=&quot;txtAddress&quot; SIZE=&quot;50&quot;
value=<%=rs.Fields(&quot;Address&quot;)%>>

Just for the fun of it, to see what happens, let's put some single quotes around the returned address value, like this:
<INPUT TYPE=&quot;text&quot; NAME=&quot;txtAddress&quot; SIZE=&quot;50&quot;
value='<%=rs.Fields(&quot;Address&quot;)%>'>

Notice the two single quotes I added?

----------------------------------------
Also, this happened to me once: The value was actually in the textbox, but the whole value just wasn't displaying properly because the textbox wasn't wide enough. When I put the cursor into the textbox, and then scrolled right, I could see the rest of the value. But that's it, right? <too easy>

Let me know if the single quotes work.
 
Mister Perry - you are absolutely 100% correct with the single quotes ;-)
Thankyou very much. Those two flyspecs had me scratching my head for the last two days.
If you're ever in Tokyo there's a futon here with your name on it.
Ward Levingston
(threeeights@hotmail.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top