PDA

View Full Version : Concatenating Output Variables


Abd
03-26-2003, 11:27 AM
Hi All,

I pls need a help in concatenating two variable, I have a piece of code which is populating a Text Area from the Database, but I want to concatenate the output in the Text Area with the firstname and it keep given me error. Please help, below is my code.

Thanks

Abd

<%
//Populating Text Area with an entire column data from the Database

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=ABD=sa;PWD=abd;DATABASE=abdul"

Set rs=Conn.execute("Select nservicereq,firstname from globe")
Commnet = RS.Fields("nservicereq")
firstname = RS.Fields("firstname")

response.write "<b>Service Reqst History:</b><br><TEXTAREA NAME='Comment' ROWS=5 COLS=80>"&vbcrlf
while not rs.eof
response.write ""&rs("nservicereq")&""&vbcrlf
rs.movenext
wend
response.write "</TEXTAREA>"&vbcrlf
rs.close
set rs=nothing
Conn.close
set Conn=nothing
%>

liorean
03-26-2003, 12:05 PM
Shouldn't this be in the Server side:ASP forum?

arnyinc
03-26-2003, 02:11 PM
Make sure you correct the spelling of "Comment" in this line, so it doesn't cause you problems later:

Commnet = RS.Fields("nservicereq")

...

What error are you getting? It seems like the following line should work, but it can be simplified:

change this line from
response.write ""&rs("nservicereq")&""&vbcrlf
to
response.write rs("nservicereq")&vbcrlf

Do you just want the "nservicereq" field in your textarea? If you want the first name also, make it

response.write rs("nservicereq")&" "&rs("firstname")&vbcrlf

Abd
03-27-2003, 06:25 AM
Hi arnyinc,

thanks it works

Abd