469,160 Members | 2,040 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,160 developers. It's quick & easy.

Difference between getrows and getstring


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

Thanks
Jul 19 '05 #1
11 4783
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" <Li********@NOTADOMAIN.com> wrote in message
news:uL**************@TK2MSFTNGP11.phx.gbl...

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

Thanks

Jul 19 '05 #2
GetRows returns a two dimensional array of the recordset. GetString returns
your records all concatenated together with some other text in between, if
you choose.

http://msdn.microsoft.com/library/en...damth02_10.asp
http://msdn.microsoft.com/library/en...damth02_11.asp

Ray at work

"Crane Linkledder" <Li********@NOTADOMAIN.com> wrote in message
news:uL**************@TK2MSFTNGP11.phx.gbl...

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

Thanks

Jul 19 '05 #3


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" <Li********@NOTADOMAIN.com> wrote in message
news:uL**************@TK2MSFTNGP11.phx.gbl...

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

Thanks

Jul 19 '05 #4
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...damth02_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.
Jul 19 '05 #5
I'm sorry. I meant getString. Is this true with getString also?
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:uF**************@TK2MSFTNGP12.phx.gbl...
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...damth02_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.

Jul 19 '05 #6
"Crane Linkledder" <Li********@NOTADOMAIN.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I'm sorry. I meant getString. Is this true with getString also?
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:uF**************@TK2MSFTNGP12.phx.gbl...
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...damth02_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
Jul 19 '05 #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" <re******@NOyahoo.SPAMcom> wrote in message
news:uF**************@TK2MSFTNGP12.phx.gbl...
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...damth02_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.

Jul 19 '05 #8
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" <no****@thankyou.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Crane Linkledder" <Li********@NOTADOMAIN.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I'm sorry. I meant getString. Is this true with getString also?
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:uF**************@TK2MSFTNGP12.phx.gbl...
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...damth02_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

Jul 19 '05 #9
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"
Jul 19 '05 #10

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
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.



Jul 19 '05 #11
> 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?
Jul 19 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Croney69 | last post: by
9 posts views Thread by bajopalabra | last post: by
10 posts views Thread by Hank | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.