?
Solved

Appending string in asp

Posted on 2006-12-01
4
Medium Priority
?
1,890 Views
Last Modified: 2012-06-27
Greeting,

I have the following format in a table.

ID   Desc
--    -----
1     this is
2     a
3     test

what I want to have is a string="this is a test". Basically, use the select statement then append the Desc field.   the ID can be null or up to any number.

thanks.

0
Comment
Question by:mrong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
alsaan earned 240 total points
ID: 18056503
Dim rsData, string
Set rsData = Server.CreateObject("ADODB.Recordset")

rsData.Open "SELECT desc FROM table ORDER BY id;", connstring

While Not rsData.EOF
    string = string & rsData("desc")
    rsData.EOF
Wend

Set rsData = Nothing
0
 
LVL 2

Expert Comment

by:alsaan
ID: 18056522
Um... the second "rsData.EOF" actually should be "rsData.MoveNext"

Greets
0
 
LVL 3

Expert Comment

by:Masoudgh
ID: 18056707
alssam's code is right but forget " "
string = string & " " & rsData("desc")
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 160 total points
ID: 18082456
Some minor corrections:

Dim rsData, Value               'String is a keyword
Set rsData = Server.CreateObject("ADODB.Recordset")

rsData.Open "SELECT desc FROM table ORDER BY id;", connstring
Value = ""
While Not rsData.EOF
    If Not IsNull(rsData("desc")) Then
       If Len(rsData("desc")) > 0 Then
          If Len(Value) > 0 Then
              Value = Value & " "
          End If
          Value = Value & rsData("desc")
       End If
     End if
    rsData.MoveNext                            ' MoveNext here
Wend
rsData.Close
Set rsData = Nothing
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question