Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: GetString Method p.465 ASP 3.0 Book


Message #1 by alldis@z... on Fri, 16 Feb 2001 14:51:07
I'm sure there is someone who could tell me why in the example use of 

GetString in the excellent book ASP 3.0 Programmers Reference (lick 

lick!), strTable is trimmed by 8 characters. For those of you who do not 

have the book here is the code:



1 strTable = rsExample.GetString(adClipString, , "</TD><TD>", _

 "</TD></TR><TR><TD>")

2 strTable = Left(strTable, Len(strTable)-8)

3 Response.Write "<TABLE BORDER=1><TR><TD>" & strTable & "</TABLE>"



Excuse any typos. The code works a treat for displaying a recordSet in an 

HTML table. But why line 2 though? It seems to work with or without it.

Pete.
Message #2 by Imar Spaanjaars <Imar@S...> on Fri, 16 Feb 2001 16:59:39 +0100
Line two deletes the last <tr><td> after the last record.



GetString adds "</TD></TR><TR><TD>" to every record. For all but the last 

this makes sense, since you want a new line / row after each record.

However, after the last record, you don't want to start a new table row and 

a cell. That's what line 2 does: it cuts off the last 8 characters, 

preventing a new <tr> and a new <td>.



The reason why this works, even without line two, is most likely because 

you use IE. Netscape is less forgiving and most likely won't show the 

complete table if you open a new row and cell without closing them again.



Hope this helps,



Imar





At 02:51 PM 2/16/2001 +0000, you wrote:

>I'm sure there is someone who could tell me why in the example use of

>GetString in the excellent book ASP 3.0 Programmers Reference (lick

>lick!), strTable is trimmed by 8 characters. For those of you who do not

>have the book here is the code:

>

>1 strTable = rsExample.GetString(adClipString, , "</TD><TD>", _

>  "</TD></TR><TR><TD>")

>2 strTable = Left(strTable, Len(strTable)-8)

>3 Response.Write "<TABLE BORDER=1><TR><TD>" & strTable & "</TABLE>"

>

>Excuse any typos. The code works a treat for displaying a recordSet in an

>HTML table. But why line 2 though? It seems to work with or without it.

>Pete.



Message #3 by Cullan Crothers <cullan.crothers@w...> on Fri, 16 Feb 2001 11:28:50 -0600
Another question about this code:



What do the commas (2) do in this line ?  ---->>>>1 strTable 

rsExample.GetString(adClipString, , "</TD><TD>" "</TD></TR><TR><TD>") The

ones just after adClipString.



Thanks;



Cullan Crothers

cullan.crothers@w...



Message #4 by Imar Spaanjaars <Imar@S...> on Fri, 16 Feb 2001 19:07:57 +0100
Do you have access to (a local copy of the) MSDN??



This is what the MSDN says about GetString:



Set Variant = recordset.GetString(StringFormat, NumRows, ColumnDelimiter, 

RowDelimiter, NullExpr)



So the commas indicate that you are skipping a parameter, namely the 

NumRows argument.



Explanation about NumRows:



NumRows Optional. The number of rows in the recordset to convert. If 

NumRows is not specified, or if it is greater than the total number of rows 

in the recordset, then all the rows in the recordset are converted.



Also, checkout: 

http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/dasdk/ados4piv.htm

Then navigate your way through ADO Programmer's Reference | ADO API 

Reference |  ADO Objects |  Recordset Object (ADO) | Properties, Methods, 

and Events

This will bring you to 

http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/dasdk/mdao3wyt.htm 

where GetRows() is mentioned under Methods.



Hope this helps,



Imar





At 11:28 AM 2/16/2001 -0600, you wrote:

>Another question about this code:

>

>What do the commas (2) do in this line ?  ---->>>>1 strTable 

>rsExample.GetString(adClipString, , "</TD><TD>" "</TD></TR><TR><TD>") The

>ones just after adClipString.

>

>Thanks;

>

>Cullan Crothers

>cullan.crothers@w...



Message #5 by "Wally Burfine" <oopconsultant@h...> on Fri, 16 Feb 2001 18:57:35 -0000
Come on, This is basic programming. All parameters to a function call are 

positional (some languages allow you to do named calls) so when there are 2 

commas in a row, that means you are accepting the default for the parameter 

that was left out.



Message #6 by Cullan Crothers <cullan.crothers@w...> on Fri, 16 Feb 2001 14:45:25 -0600
Alright Wally...

Just Checking It Out...

How am I supposed to know whiat the parameters were that were being left

out...





-----Original Message-----

From: Wally Burfine [mailto:oopconsultant@h...]

Sent: Friday, February 16, 2001 12:58 PM

To: ASP Databases

Subject: [asp_databases] Re: GetString Method p.465 ASP 3.0 Book





Come on, This is basic programming. All parameters to a function call are

positional (some languages allow you to do named calls) so when there are 2

commas in a row, that means you are accepting the default for the parameter

that was left out.



Message #7 by "Wally Burfine" <oopconsultant@h...> on Sat, 17 Feb 2001 02:40:25 -0000
Actually it's very simple to start looking for something like that.



Go to: http://www.microsoft.com/ms.htm and enter something into the search 

box. In this case getrows. It may or may not return some information. 

Usually, when you have questions about a function, the help sources are 

pretty good to give enough information to get started. Although sometimes, 

it has a high fog index and seems like unintelligible gibberish.



Regards,

Wally



>From: Cullan Crothers <cullan.crothers@w...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Re: GetString Method p.465 ASP 3.0 Book

>Date: Fri, 16 Feb 2001 14:45:25 -0600

>

>Alright Wally...

>Just Checking It Out...

>How am I supposed to know whiat the parameters were that were being left

>out...

>

>

>-----Original Message-----

>From: Wally Burfine [mailto:oopconsultant@h...]

>Sent: Friday, February 16, 2001 12:58 PM

>To: ASP Databases

>Subject: [asp_databases] Re: GetString Method p.465 ASP 3.0 Book

>

>

>Come on, This is basic programming. All parameters to a function call are

>positional (some languages allow you to do named calls) so when there are 2

>commas in a row, that means you are accepting the default for the parameter

>that was left out.

>

>
Message #8 by Imar Spaanjaars <Imar@S...> on Sat, 17 Feb 2001 14:01:33 +0100
Or better yet, search directly in the MSDN, skipping some non-developer 

related material:



http://search.microsoft.com/us/dev/default.asp





Imar



(Sorry if this gets too off-topic)





At 02:40 AM 2/17/2001 +0000, you wrote:

>Actually it's very simple to start looking for something like that.

>

>Go to: http://www.microsoft.com/ms.htm and enter something into the search 

>box. In this case getrows. It may or may not return some information. 

>Usually, when you have questions about a function, the help sources are 

>pretty good to give enough information to get started. Although sometimes, 

>it has a high fog index and seems like unintelligible gibberish.

>

>Regards,

>Wally

>

>>From: Cullan Crothers <cullan.crothers@w...>

>>Reply-To: "ASP Databases" <asp_databases@p...>

>>To: "ASP Databases" <asp_databases@p...>

>>Subject: [asp_databases] Re: GetString Method p.465 ASP 3.0 Book

>>Date: Fri, 16 Feb 2001 14:45:25 -0600

>>

>>Alright Wally...

>>Just Checking It Out...

>>How am I supposed to know whiat the parameters were that were being left

>>out...




  Return to Index