[Lazarus] Functions, procedures etc for using Dbase3/4 files ... what are they in Lazarus? (I used XBase1 in Delphi 5)

Joost van der Sluis joost at cnoc.nl
Tue Jun 15 11:40:14 CEST 2010


On Tue, 2010-06-15 at 14:54 +1000, Peter E Williams wrote:
> Hi All,
> 
> On Mon, 2010-06-14 at 17:37 +0200, Michael Van Canneyt wrote:
> > You may want to look at the TDBF component. I think the package is
> > called
> > lazdbf or dbflaz.
> > 
> > Michael.
> 
> On Mon Jun 14 18:00:51 CEST 2010, Howard Page-Clark wrote:
> > For a general introduction have a look at
> > http://wiki.lazarus.freepascal.org/Lazarus_Database_Tutorial
> 
> I have looked at this document
> 
> > For using Tdbf have a look at
> > http://wiki.lazarus.freepascal.org/Lazarus_Tdbf_Tutorial
> 
> and printed out and read this one.
> 
> and I have studied the Address Example and the other database example.
> 
> // need changing 0.50.alpha
> //(Sender as Taction).Enabled:=Active;
> if (GetFieldByName('x1_pos') = str_x[1]) and
> 
> I cannot find what to change XBase1's GetFieldByName(string) function
> to. It accepts a field name as a parameter and returns a string.

Dataset.FieldByName('fieldname').AsString;

> // #### how do I do this
> HexxData_DBF.UpdFieldStr('x' + inttostr(x) + '_left',
> option_2_str(pattern1.option[x, 1]));
> 
> I cannot find what to change XBase1's UpdFieldStr(string, string)
> function. The first parameter is the field name e.g. 'x1_left' and the
> second parameter is a string value to assign to the first parameter.

Dataset.FieldByName('FieldName').AsString := NewValue;

> HexxData_DBF.AppendBlank;
> Is this how I append a blank record? The documents quoted above don't
> mention appending a blank record.

Dataset.Append; <nothing in between, so it's blank> Dataset.Post;

> HexxData_DBF_rec_no := HexxData_DBF.RecNo;
> I need to get the record number and assign it to a longint

Using records numbers is evil! But it'll work in the tDbf (Dbase) case:
Rec_No := dataset.RecNo;

> HexxData_DBF.GotoRecord(HexxData_DBF_rec_no); // ### needs changing
> Then I need a Function to Goto the Record saved in the above assignment

Dataset.RecNo := Rec_No;

But you shouldn't use that. Use bookmarks instead.

Joost.





More information about the Lazarus mailing list