asp solution?

Discussion in 'ASP General' started by Bob Barrows, Sep 8, 2003.

  1. Bob Barrows

    Bob Barrows Guest

    Need_help wrote:
    > 1. SELECT VALUES FROM TABLE A WHERE ID=5
    >
    > 2. I create an array x(0,n), and I populate n with the values based on
    > select above.
    >
    > What I have... I have x(0,1)
    > x(0,2)
    > x(0,3)... and so on.
    >
    > Result:> I need to have variable called
    > varx that should consist all the values from x(0,1), x(0,2), x(0,n).
    >
    > So I need to declare varx = x(0,1) & "," & x(0,2) & etc.
    >
    > 1. question. I don't know how many elements I would have, coz they
    > depends on "select".
    > 2. Can someone give me example how I can dynamicly create (parse) this
    > values in single variable, so I can send this values to pageB.asp


    This demonstrates using GetRows to create your array and also shows how to
    process the resulting array. For more detail, see ADO online help at
    msdn.microsoft.com.

    dim cn,sConnect,sSQL,rs,ar, iRow, iCol
    sSQL = "SELECT VALUES FROM TABLE A WHERE ID=5"

    'for debugging purposes:
    response.write sSQL
    'you can get rid of this line when debugging is complete

    sConnect = "<valid connection string>"
    ' - see www.able-consulting.com/ado_conn.htm - concentrate on the
    'OLEDB connection examples for your database
    set cn=server.createobject("adodb.connection")

    cn.open sConnect
    set rs=cn.execute(sSQL,,1)
    if not rs.eof then ar=rs.getrows
    rs.close
    set rs=nothing
    cn.close
    set cn=nothing
    if isarray(ar) then
    for iRow=0 to ubound(ar,2)
    for iCol = 0 to ubound(ar,1)
    response.write ar(iCol,iRow) & "; "
    next
    response.write "<br>"
    next
    else
    response.write "no records were returned"
    end if

    HTH,
    Bob Barrows
     
    Bob Barrows, Sep 8, 2003
    #1
    1. Advertising

  2. "Need_help" wrote:
    >
    > 1. SELECT VALUES FROM TABLE A WHERE ID=5


    [snip]

    http://www.aspfaq.com/5005


    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
     
    Dave Anderson, Sep 8, 2003
    #2
    1. Advertising

  3. Bob Barrows

    only_me Guest

    Try the "join" function
    Description
    Returns a string created by joining a number of substrings contained in an
    array.
    Syntax
    Join(list[, delimiter])
    The Join function syntax has these parts:



    "Need_help" <> wrote in message
    news:...
    > 1. SELECT VALUES FROM TABLE A WHERE ID=5
    >
    > 2. I create an array x(0,n), and I populate n with the values based on
    > select above.
    >
    > What I have... I have x(0,1)
    > x(0,2)
    > x(0,3)... and so on.
    >
    > Result:> I need to have variable called
    > varx that should consist all the values from x(0,1), x(0,2), x(0,n).
    >
    > So I need to declare varx = x(0,1) & "," & x(0,2) & etc.
    >
    > 1. question. I don't know how many elements I would have, coz they depends
    > on "select".
    > 2. Can someone give me example how I can dynamicly create (parse) this
    > values in single variable, so I can send this values to pageB.asp
    >
    >
     
    only_me, Sep 16, 2003
    #3
  4. Bob Barrows

    Need_help Guest

    1. SELECT VALUES FROM TABLE A WHERE ID=5

    2. I create an array x(0,n), and I populate n with the values based on
    select above.

    What I have... I have x(0,1)
    x(0,2)
    x(0,3)... and so on.

    Result:> I need to have variable called
    varx that should consist all the values from x(0,1), x(0,2), x(0,n).

    So I need to declare varx = x(0,1) & "," & x(0,2) & etc.

    1. question. I don't know how many elements I would have, coz they depends
    on "select".
    2. Can someone give me example how I can dynamicly create (parse) this
    values in single variable, so I can send this values to pageB.asp
     
    Need_help, Oct 24, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Francis
    Replies:
    0
    Views:
    426
    Andrew Francis
    Jun 28, 2006
  2. =?Utf-8?B?Y2FzaGRlc2ttYWM=?=

    Solution file not in the solution folder

    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=, Sep 12, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    1,115
    Laurent Bugnion
    Sep 12, 2006
  3. , India
    Replies:
    17
    Views:
    1,068
    James Kanze
    Oct 1, 2007
  4. Replies:
    8
    Views:
    516
  5. email55555 email55555

    [SOLUTION] Ruby Quiz #14 LCD Numbers ( solution #2 )

    email55555 email55555, Jan 9, 2005, in forum: Ruby
    Replies:
    16
    Views:
    285
    David Tran
    Jan 10, 2005
Loading...

Share This Page