Results 1 to 3 of 3

Thread: HELP, rs.fields(i).value is destructive

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    1

    HELP, rs.fields(i).value is destructive

    HELP!!!
    I think that I am going crazy.

    1 program seems to get this problem intermittantly.

    I can only read the data once. They it goes to null

    ODBCRS.Close:Set ODBCRS = ODBCCon.Execute(SQLString, iRecordsAffected)
    ? ODBCRS.Fields(93).Value,ODBCRS.Fields(93).Value
    Sergio Null

    Even ? ODBCRS.Fields(94) will charge field 93 to nulls

    It does NOT happen on all fields. Field 94 in this case works fine.

    What am I missing?

    Help!!!!!!!!!!!!!
    Jack

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: HELP, rs.fields(i).value is destructive

    Welcome to VBForums

    At the moment we haven't got enough information to be able to help - the kind of thing we need are the first 2 bullet points of Before you post..., the SQL statement you are running, and the data type of the field(s) that are returned by it (especially the one that is giving you problems).

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: HELP, rs.fields(i).value is destructive

    This will happen if the datatype of Fields(93) is a Blob field (memo, text, image). Check out this code

    Code:
    If Not IsNull(ODBCRS.Fields(93).Value) Then
        Debug.Print ODBCRS.Fields(93).Value 
    End If
    The Debug statement "could" print Null. This is because Blob fields are accessed in "Chunks" each time they are referenced. I can't remember the default chunk size but I think it is 4kb.

    In the code above the If statement causes ADO to get the 1st chunk of data. The Debug statement gets the 2nd chunk but if all data was returned in the 1st chunk, it prints Null.

    [edit] The above depends on which Provider you are using to connect to the database. If I remember correctly it only happens with the default provider (MSDASQL).
    Last edited by brucevde; Jul 31st, 2008 at 11:52 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width