Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    215
    Thanks
    14
    Thanked 0 Times in 0 Posts

    concatenate multiple records

    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:
    Code:
    <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

  • #2
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <%=(rsUserName.Fields.Item("EmpNo").Value)%> - <%=(rsUserName.Fields.Item("EmpFirstName").Value)%> <%=(rsUserName.Fields.Item("EmpLastName").Value)%>
    or
    Code:
    <%
    Response.Write (rsUserName.Fields.Item("EmpNo").Value) & " - " & (rsUserName.Fields.Item("EmpFirstName").Value) & " " & (rsUserName.Fields.Item("EmpLastName").Value)
    %>

  • #3
    Regular Coder
    Join Date
    May 2005
    Posts
    215
    Thanks
    14
    Thanked 0 Times in 0 Posts
    That worked perfect.

    Thanks,

    Parallon


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •