Actually, .Item is the default property of the Fields collection (actually
of all standard collections).  We are just so used to dropping it.
Personally, I prefer the longer form rsProfile.Fields("MoreInfo").Value over
rsProfile("MoreInfo"), and AFAIK it provides better performance.  The
shortened form rsProfile("MoreInfo") can also result in an ambiguity in
certain situations.

Regards,
Tore.

-----Original Message-----
From: Showbear [mailto:[EMAIL PROTECTED]]
Sent: Sunday, September 01, 2002 5:46 AM
To: ActiveServerPages
Subject: RE: extension problems



Ricki, is rsProfile an ADO recordset?  I don't remember the Fields
collection having a property 'Item'... what's that supposed to do?  Try:

<%= CropSentence(rsProfile.Fields("MoreInfo").Value, 100, "...") %>

Although it is becoming unfashionable to do so, you can rely upon
default properties in ADO.  The default property of the recordset is
Fields and the default property of Fields is Value, so you can simply
write:

<%= CropSentence(rsProfile("MoreInfo"), 100, "...") %>

to make your code easier to read.  Some developers sniff at such code
and warn (probably rightly) that it may one day not work, but there's a
LOT of it out there...

HTH


-----Original Message-----
From: Ricki Williams [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, September 01, 2002 12:37 AM
To: ActiveServerPages
Subject: extension problems


I'm sorry if I'm posting this in the wrong place, but it's late and I'm
getting really frustrated.

I've downloaded and installed the "Crop Sentence" extension from the
exchange.  When I run it , I get this syntax error. Microsoft VBScript
compilation  error '800a03ea'

Syntax error

/search/quickquery.asp, line 467

FUNCTION CropSentence(strText, intLength, strTrial)
^

I haven't hand coded any of this, the code has been added by the
extension

Here is the code I'm using to call the function:
<% =(CropSentence((rsProfile.Fields.Item("MoreInfo").Value), 100,
"...")) %>

Here is the code for the function:
          <%
FUNCTION CropSentence(strText, intLength, strTrial)
  Dim wsCount
  Dim intTempSize
  Dim intTotalLen
  Dim strTemp

  wsCount = 0
  intTempSize = 0
  intTotalLen = 0
  intLength = intLength - Len(strTrial)
  strTemp = ""

  IF Len(strText) > intLength THEN
    arrTemp = Split(strText, " ")
    FOR EACH x IN arrTemp
      IF Len(strTemp) <= intLength THEN
        strTemp = strTemp & x & " "
      END IF
    NEXT
      CropSentence = Left(strTemp, Len(strTemp) - 1) & strTrial
  ELSE
    CropSentence = strText
  END IF
END FUNCTION
%>


Has anyone ever used this and gotten it to work?  Can anyone see what is
wrong with it?

Thanks,
Ricki


---
You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED] To unsubscribe send a blank email to
%%email.unsub%%



---
You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%

---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to