...

View Full Version : concatenate multiple records



parallon
03-20-2006, 04:56 PM
Hello all. I am a little new to Variables in ASP, and a little confused on concatenating multiple variables together. I have fields in the database for EmpNo, EmpFirstName, and EmpLastName, and what I want to do is to is enter all three values together in a field i.e. 13 - John Doe.

This code is working for 1 value, but not sure how to get the other two:

<td width="60"><div align="left"><%=(rsUserName.Fields.Item("EmpNo").Value)%></div></td>

Granted, I could repeat the part between the <% %> tags for each record, which did work, but is that the best way? If so, how would I put spaces between each item?

Thanks in advance,

Parallon

degsy
03-20-2006, 06:13 PM
<%=(rsUserName.Fields.Item("EmpNo").Value)%> - <%=(rsUserName.Fields.Item("EmpFirstName").Value)%> <%=(rsUserName.Fields.Item("EmpLastName").Value)%>


or


<%
Response.Write (rsUserName.Fields.Item("EmpNo").Value) & " - " & (rsUserName.Fields.Item("EmpFirstName").Value) & " " & (rsUserName.Fields.Item("EmpLastName").Value)
%>

parallon
03-20-2006, 09:38 PM
That worked perfect.

Thanks,

Parallon



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum