Re: ActualSize returns -1 for Text fields



Rod wrote on Fri, 23 Sep 2005 09:59:52 -0400:

> I have a table called 'mytable' with two fields in it Fld1, and Fld2.
> Fld1 is a text field and Fld2 is char(10) . If I create an ADORecordSet
> object using the following query:
>
> select * from mytable
>
> I can't read the contents of the text field (Fld1). ActualSize of this
> field is always -1 even though I can see the data in the table from SQL
> Enterprise Manager. Same is true if I use the query explicitly listing
> the fields:

Do you read that field multiple times? IIRC, using a server side cursor the
first time you read the field ADO will then discard the underlying pointer
to that text field, and all fields to the left of it in the recordset. Then
if you attempt to read the field or it's properties a second time it will
appear as empty with a size of -1. I always read ADO recordsets from left to
write, and if I need to check the value of a field more than once then I
read it into a variable, and use the variable for subsequent tests.

Dan


.



Relevant Pages

  • Re: ActualSize returns -1 for Text fields
    ... > Do you read that field multiple times? ... As I said in my original post, ... query that returned two or more of these fields. ... What exactly do you mean by "I always read ADO recordsets from left to ...
    (microsoft.public.data.ado)
  • DTS ActiveX task
    ... I have a task that I want to use a combination of ADO recordsets and TSQL. ... How do I, for instance perform a count query, and do some functionality ...
    (microsoft.public.sqlserver.dts)
  • Re: Query design using wildcards
    ... QM-101 etc. I'd like the query to get all the QP's. ... > And, if by some chance you're using ADO recordsets, the wildcard will be %, ... > Doug Steele, Microsoft Access MVP ...
    (microsoft.public.access.tablesdbdesign)