Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seperate Results with a comma 2

Status
Not open for further replies.

jojo79

Programmer
Oct 11, 2006
40
US
I have an asp page that creates a Server.CreateObject("ADODB.recordset"), What I am trying to do is have the retune value seperated by a comma. Example below.
Code:
skew = request.querystring("q")
sql="SELECT wh_qty,wh_skid,wh_cases FROM ipc_warehouse WHERE wh_skew= '" + skew + "'"

after creating a ADODB.recordset I am currently using the following code to return my sql.

Code:
do until rs.EOF
   for each x in rs.fields
        response.write("total inv. " & x.value & " !")
    next
   rs.MoveNext
loop

I am trying to get the results to comeback separated by a comma, no column name just the value.

Example:
Code:
response.write rs("wh_skid")","rs("wh_cases")","rs("wh_qty")

Any help or direction would be great, Thanks in advance.

 
Assign the return value from the query to a variable, then in your loop just append the new value with a comma onto the end of it:

Code:
dim totalInvString
do until rs.EOF
   for each x in rs.fields
      totalInvString = totalInvString & x.value & ",";    
   next
   rs.MoveNext
loop

After this you will have a comma delimited set of values with a comma on the end. You may or may not want to keep that comma on the end. If not, just trim the last character off of totalInvString.


[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top