handling Dbase memo fields 
Author Message
 handling Dbase memo fields

I have written an old DOS Clipper application using Dbase files
Now, in the new windows delphi version, how can I put the text of a memo
field into a string variable or into a calculated field?
How is possible to put the text in a TBDGRID?

THANKS ALL

Fabio Cappello



Fri, 16 Jan 1998 03:00:00 GMT  
 handling Dbase memo fields
: I have written an old DOS Clipper application using Dbase files
: Now, in the new windows Delphi version, how can I put the text of a memo
: field into a string variable or into a calculated field?
: How is possible to put the text in a TBDGRID?

Memo data, because it is potentially so large, is not really compatible
with Pascal String type variables (which have a maximum size of 255 bytes).
You could read data directly from a memo field in chunks that do not
exceed this size, putting the extracted value into separate String type
variables. Or you could read data from a memo field into a zero-termin-
ated string (which can be much larger than a String variable) and then
parse that PChar.

In either case, a TBlobStream object would be needed to extract the data
from the memo field. This object has a Read method that can read data
from a memo field into a PChar variable. From there, the PChar variable
can be parsed or, if it is not too long, directly translated to a Pascal
type String. For example, the following reads 50 characters from a memo
field called Notes in a TTable called Table1. The TMemoField object
Table1Notes has already been created using the Fields Editor to represent
the memo field. The extracted data is then transferred to the Text prop-
erty of a TEdit component called Edit1.

  var
    BS: TBlobStream;
    P: array [0..50] of Char;
  begin
    BS := TBlobStream.Create(Table1Notes, bmRead);
    try
      BS.Read(P, 50);
      Edit1.Text := StrPas(P);
    finally
      BS.Free;
    end;
  end;

--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Steve Koterski               _/   The opinions expressed here are    _/

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/



Sat, 17 Jan 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Clarification: on ChimneySweep's new handling of memo-field repairs

2. Delphi/Access Blob handles with memo fields

3. packing dbase memo fields

4. dbase iv memo fields with SQL?

5. D4: Strange characters in DBASE memo-fields

6. can someone explain dbase memo fields

7. Dbase memo fields

8. What is the syntax for copy a memo to a database memo field

9. Memo Field to Database field

10. Copy data from string field to memo field

11. Storing Memo fields in Databases (Blob Fields?)

12. Help: DBMemo in character-field (not Memo-field)

 

 
Powered by phpBB® Forum Software