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

Populate textarea with recordset

Status
Not open for further replies.

jasonhuibers

Programmer
Sep 12, 2005
290
CA
I have 10 records in database and I want to populate the textarea box with 1 record after each other?

How can I do this?
 
???
1 textbox with data from 10 records? 10 textareas from 10 records? 10 columns? 10 rows?
???
 
Append a vbcrlf (Carriage Return + Line Feed) variable to each record

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
 
Yes, 10 records into 1 textarea...

Hi ChrisHirst... I Have a loop - how can I append the vbcrlf variable to each record? Can you show me an example?

Basically I am trying to show chat content on the page - but I am using a textarea so I am able to scroll and to have other controls under the textarea.
 
untested/ pseudocode:

Code:
<textarea>
<%
cSQL = "SELECT TOP 10 content FROM chat"
rs.open cSQL, conn
do while not rs.eof
 response.write rs("content") & vbCrLf
 rs.movenext
loop
rs.close
%>
</textarea>

 
there is only one way to found out........
and i presume you are clever enough to define and open a connection etc
 
foxbox's suggestions should work. i should add that you can make a string that has all the ten records plus a vbcrlf at end of each record then put the whole string in the text area.
Code:
<%cSQL = "SELECT TOP 10 content FROM chat"
rs.open cSQL, conn
do while not rs.eof 
   msg = msg & rs("content") & vbCrLf 
   rs.movenext
loop
rs.close%>
<textarea>
response.write msg
</textarea>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top