Difference between getrows and getstring

Discussion in 'ASP General' started by Crane Linkledder, Oct 29, 2003.

  1. What is the difference, and when to use one over the other?

    Thanks
     
    Crane Linkledder, Oct 29, 2003
    #1
    1. Advertising

  2. GetRows() is typically used when you still need to do row-by-row processing,
    or you need to refer to certain members in the set individually.

    GetString() is useful when you need a formatted string that has simple
    determinations for what goes between a "row" and "column" (e.g. not too much
    complex iteration or conditional logic, like when alternating row colors for
    display)... see one usage here: http://www.aspfaq.com/2482

    For more comparison stuff, see http://www.aspfaq.com/2467

    A



    "Crane Linkledder" <> wrote in message
    news:uLcl$...
    >
    > What is the difference, and when to use one over the other?
    >
    > Thanks
    >
    >
     
    Aaron Bertrand - MVP, Oct 29, 2003
    #2
    1. Advertising

  3. Crane Linkledder

    Ray at Guest

    Ray at, Oct 29, 2003
    #3
  4. Thanks to the both of you. One last question. When using getrows, is it
    possible to exclude specific columns?

    I am selecting more columns in my SELECT statement than I'd like to display
    on screen. How can I filter them out?

    Thanks




    "Crane Linkledder" <> wrote in message
    news:uLcl$...
    >
    > What is the difference, and when to use one over the other?
    >
    > Thanks
    >
    >
     
    Crane Linkledder, Oct 29, 2003
    #4
  5. Crane Linkledder

    Bob Barrows Guest

    Crane Linkledder wrote:
    > Thanks to the both of you. One last question. When using getrows, is
    > it possible to exclude specific columns?
    >

    The documentation is here:
    http://msdn.microsoft.com/library/en-us/ado270/htm/mdamth02_10.asp

    As you will see, you can supply an " ... array of field names or ordinal
    position numbers" in the third argument. So if you wanted to only use the
    first, third and fifth fields in the recordset, you could do this:

    arResults = rs.GetRows(,,array(0,2,4))

    The MSDN Library is your friend.

    HTH,
    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows, Oct 29, 2003
    #5
  6. I'm sorry. I meant getString. Is this true with getString also?


    "Bob Barrows" <> wrote in message
    news:uFz$...
    > Crane Linkledder wrote:
    > > Thanks to the both of you. One last question. When using getrows, is
    > > it possible to exclude specific columns?
    > >

    > The documentation is here:
    > http://msdn.microsoft.com/library/en-us/ado270/htm/mdamth02_10.asp
    >
    > As you will see, you can supply an " ... array of field names or ordinal
    > position numbers" in the third argument. So if you wanted to only use the
    > first, third and fifth fields in the recordset, you could do this:
    >
    > arResults = rs.GetRows(,,array(0,2,4))
    >
    > The MSDN Library is your friend.
    >
    > HTH,
    > Bob Barrows
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
     
    Crane Linkledder, Oct 30, 2003
    #6
  7. It says-
    Variant = recordset.GetString(StringFormat, NumRows, ColumnDelimiter,
    RowDelimiter, NullExpr)
    It does not look like it is possible to filter out columns using getString.
    How can I get around this?TIA

    "Bob Barrows" <> wrote in message
    news:uFz$...
    > Crane Linkledder wrote:
    > > Thanks to the both of you. One last question. When using getrows, is
    > > it possible to exclude specific columns?
    > >

    > The documentation is here:
    > http://msdn.microsoft.com/library/en-us/ado270/htm/mdamth02_10.asp
    >
    > As you will see, you can supply an " ... array of field names or ordinal
    > position numbers" in the third argument. So if you wanted to only use the
    > first, third and fifth fields in the recordset, you could do this:
    >
    > arResults = rs.GetRows(,,array(0,2,4))
    >
    > The MSDN Library is your friend.
    >
    > HTH,
    > Bob Barrows
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
     
    Crane Linkledder, Oct 30, 2003
    #7
  8. "Crane Linkledder" <> wrote in message
    news:%...
    > I'm sorry. I meant getString. Is this true with getString also?
    >
    >
    > "Bob Barrows" <> wrote in message
    > news:uFz$...
    > > Crane Linkledder wrote:
    > > > Thanks to the both of you. One last question. When using getrows,

    is
    > > > it possible to exclude specific columns?
    > > >

    > > The documentation is here:
    > > http://msdn.microsoft.com/library/en-us/ado270/htm/mdamth02_10.asp
    > >
    > > As you will see, you can supply an " ... array of field names or

    ordinal
    > > position numbers" in the third argument. So if you wanted to only

    use the
    > > first, third and fifth fields in the recordset, you could do this:
    > >
    > > arResults = rs.GetRows(,,array(0,2,4))


    No, there is no parameter for the GetString method that corresponds to
    the Fields parameter in the GetRows method. However, I'll bet
    dollars-to-donuts that if you provide the sql statement we can "hide"
    the fields you don't need.

    HTH
    -Chris Hohmann
     
    Chris Hohmann, Oct 30, 2003
    #8
  9. Thank you. I was starting to panic.


    Here is my statement-

    SQL = "SELECT " & users & ".one, " & users & ".two,
    "&calendar&".appointmentStart, "&calendar&".appointmentEnd, "&calendar&".ID,
    "&calendar&".ownerID, "&calendar&".clientID, " & users & ".userID " &_
    "FROM "&calendar&", " & users & " " &_
    "WHERE "&users&".userID = "&calendar&".clientID " &_
    " AND recurring = '0' ORDER BY appointmentStart"


    I am trying to avoid displaying-

    calendar&".ownerID "
    calendar&".clientID "
    users & ".userID "











    "Chris Hohmann" <> wrote in message
    news:%...
    > "Crane Linkledder" <> wrote in message
    > news:%...
    > > I'm sorry. I meant getString. Is this true with getString also?
    > >
    > >
    > > "Bob Barrows" <> wrote in message
    > > news:uFz$...
    > > > Crane Linkledder wrote:
    > > > > Thanks to the both of you. One last question. When using getrows,

    > is
    > > > > it possible to exclude specific columns?
    > > > >
    > > > The documentation is here:
    > > > http://msdn.microsoft.com/library/en-us/ado270/htm/mdamth02_10.asp
    > > >
    > > > As you will see, you can supply an " ... array of field names or

    > ordinal
    > > > position numbers" in the third argument. So if you wanted to only

    > use the
    > > > first, third and fifth fields in the recordset, you could do this:
    > > >
    > > > arResults = rs.GetRows(,,array(0,2,4))

    >
    > No, there is no parameter for the GetString method that corresponds to
    > the Fields parameter in the GetRows method. However, I'll bet
    > dollars-to-donuts that if you provide the sql statement we can "hide"
    > the fields you don't need.
    >
    > HTH
    > -Chris Hohmann
    >
    >
     
    Crane Linkledder, Oct 30, 2003
    #9
  10. Crane Linkledder

    Bob Barrows Guest

    Crane Linkledder wrote:
    > Thank you. I was starting to panic.
    >
    >
    > Here is my statement-
    >
    > SQL = "SELECT " & users & ".one, " & users & ".two,
    > "&calendar&".appointmentStart, "&calendar&".appointmentEnd,
    > "&calendar&".ID, "&calendar&".ownerID, "&calendar&".clientID, " &
    > users & ".userID " &_ "FROM "&calendar&", " & users & " " &_
    > "WHERE "&users&".userID = "&calendar&".clientID " &_
    > " AND recurring = '0' ORDER BY appointmentStart"
    >
    >
    > I am trying to avoid displaying-
    >
    > calendar&".ownerID "
    > calendar&".clientID "
    > users & ".userID "
    >

    Why retrieve the fields at all if you don't want to display them?

    Are you doing something else with their contents behind the scenes? If so,
    you will need to go with the GetRows solution.

    Bob Barrows


    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows, Oct 30, 2003
    #10
  11. "Bob Barrows" <> wrote in message
    news:...
    > Crane Linkledder wrote:
    > > Thank you. I was starting to panic.
    > >
    > >
    > > Here is my statement-
    > >
    > > SQL = "SELECT " & users & ".one, " & users & ".two,
    > > "&calendar&".appointmentStart, "&calendar&".appointmentEnd,
    > > "&calendar&".ID, "&calendar&".ownerID, "&calendar&".clientID, " &
    > > users & ".userID " &_ "FROM "&calendar&", " & users & " " &_
    > > "WHERE "&users&".userID = "&calendar&".clientID " &_
    > > " AND recurring = '0' ORDER BY appointmentStart"
    > >
    > >
    > > I am trying to avoid displaying-
    > >
    > > calendar&".ownerID "
    > > calendar&".clientID "
    > > users & ".userID "
    > >

    > Why retrieve the fields at all if you don't want to display them?
    >
    > Are you doing something else with their contents behind the scenes? If so,
    > you will need to go with the GetRows solution.
    >
    > Bob Barrows
    >
    >
    > --
    > Microsoft MVP - ASP/ASP.NET
    > Please reply to the newsgroup. This email account is my spam trap so I
    > don't check it very often. If you must reply off-line, then remove the
    > "NO SPAM"
    >
    >



    I somehow got it in my head that I needed to select all the columns that I'm
    using in my select statement... WHERE column6 = column7

    I just removed those and it's working regardless.

    Thanks for pointing that out.
     
    Crane Linkledder, Oct 30, 2003
    #11
  12. > I am selecting more columns in my SELECT statement than I'd like to
    display
    > on screen. How can I filter them out?


    Drop them from the SELECT? Why are you bothering to select them if you're
    not using them?
     
    Aaron Bertrand - MVP, Oct 30, 2003
    #12
    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. jakk
    Replies:
    4
    Views:
    12,279
  2. Replies:
    1
    Views:
    336
  3. Croney69

    Using GetRows()

    Croney69, Jul 28, 2003, in forum: ASP General
    Replies:
    5
    Views:
    178
    Bob Barrows
    Jul 28, 2003
  4. Moshe

    GetRows Mystery

    Moshe, Aug 28, 2003, in forum: ASP General
    Replies:
    8
    Views:
    142
    Bob Barrows
    Aug 28, 2003
  5. shank

    GetRows() and hyperlinks

    shank, Mar 17, 2008, in forum: ASP General
    Replies:
    1
    Views:
    112
    Daniel Crichton
    Mar 17, 2008
Loading...

Share This Page