View Full Version : concatenate multiple records

03-20-2006, 03: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,


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


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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum