-----

  Set fld = rs("myFld")

is a field object assignment

  fld = rs("myFld")

assigns the defaults (basically rs.FIelds.Item("myFld").Value) to fld

If I use a recordset, I prefer to use this form:

  Set fld = rs.Fields.Item("myFld")

  Response.Write fld.Value

A quick glance at all the properties/methods/events of ADODB would be to
open up your copy of VB6, add a reference to Microsoft ActiveX Data Objects
2.x and then press F2 to jump to the object browser.

David L. Penton, Microsoft MVP
JCPenney Technical Specialist / Lead
"Mathematics is music for the mind, and Music is Mathematics for the
Soul. - J.S. Bach"
[EMAIL PROTECTED]

Do you have the VBScript Docs or SQL BOL installed?  If not, why not?
VBScript Docs: http://www.davidpenton.com/vbscript
SQL BOL: http://www.davidpenton.com/sqlbol

-----Original Message-----
From: Showbear [mailto:[EMAIL PROTECTED]]

Tore, apparently even Microsoft has become used to dropping the Item
property.  The MSDN Library includes quite a few different documents
with detailed models and descriptions of the major ADO 2.7 objects,
including Recordset and Field but none of them include any mention of
the Item property.  However a search on Item eventually - it wasn't
easy! - produced a document proving you correct, and three more with
samples showing its use.  I know, I should have just accepted that you
were right. :-)

In what situations can the shortened form result in ambiguity?

TIA


-----Original Message-----
From: Bostrup, Tore [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 03, 2002 9:57 AM
To: ActiveServerPages
Subject: RE: extension problems


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 PROTECTED]

Reply via email to