Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Problem reading Memo Field with GetChunk


Message #1 by "Jonathan Branam" <sspeare@y...> on Tue, 14 May 2002 02:09:35
Hello,

I am having some trouble with Memo Fields. I am using ServerSide 
JavaScript and an Access Database. I have the following function which 
retrieves the text inside a Field in a given Recordset.

When the function tries to read a Memo Field, it always fails the first 
read on a given Recordset. Then, the function is called a second time for 
the same Field, on the next Record. This time, it works properly. (I am 
just printing out the records in order now). This is the only Memo Field, 
and it is being SELECTed last (not using SELECT *).

I also run into some problems when I use the string conversion routines on 
the data returned by GetChunk. These seem related, but I'm quite confused 
as to why.

Another question is there a way to reset the GetChunk to read from the 
beginning again? Sometimes I want to print the field twice, and I am using 
a data description language, so I can't hardcode things.

function GetSimpleText(LogicalInfoRS, DataRS, LogicalFieldsRS, Options)
{
  var sLocalField  = LogicalFieldsRS("LocalField")+"";
  var sLabel       = LogicalFieldsRS("Name")+"";
  var sValue;
  var nSize;

  if (DataRS(sLocalField).Attributes & adFldLong)
  {
    nSize = parseInt(DataRS(sLocalField).ActualSize);
    if (nSize > 0)
    {
      sValue = DataRS(sLocalField).GetChunk(nSize);
    } else {
      sValue = "ActualSize is 0?";
    }
  } else {
    sValue 		= DataRS(sLocalField)+"";
  }
  return sValue;
}

Thanks for any help!
-Jonathan

  Return to Index