Recent

Author Topic: Get rid of DBNavigator ...  (Read 831 times)

1HuntnMan

  • Full Member
  • ***
  • Posts: 240
  • From Delphi 7 to Lazarus
    • NewFound Photo Art
Get rid of DBNavigator ...
« on: August 11, 2024, 10:33:30 pm »
I have a previous post with a conflict between DBNav and a JvDBLookUpCombo.
Anyway, thought I'd try another strategy and found this in the Lazarus Tdbf Tutorial.  See code below.  This doesn't work if I attempt to enter and place a SpeedBtn on the panel and onclick event Dbf Proposals.DataSet.First(); . Laz won't even recognize this??? Just testing to cure the other post I made about the JvDBLookUpCombo disappearing value by creating a Nav without using the DBNavigator.

Code: Pascal  [Select][+][-]
  1. Moving Thru Table Records
  2. (Jumping to Beginning of File, End of File, Next Record, Prior Record, etc.)
  3. DbfContacts.FilePathFull := '/home/somelocation/database_location/';   // Path to
  4.         the database directory
  5. DbfContacts.TableName := 'Contacts.dbf;    // database file (including extension)
  6. DbFContacts.Open;
  7. DbfContacts.DataSet.First();   // -> Go to the first record
  8. DbfContacts.DataSet.Prior();  // -> Go to the previous record
  9. DbfContacts.DataSet.Next();  //->  Go to the next record
  10. DbfContacts.DataSet.Last();  //->  Go to the last record
  11. DbfContacts.DataSet.BOF;  { Is the cursor at the beginning of the data
  12.                                     (on the first record) , returns boolean }
  13. DbfContacts.DataSet.EOF;  //->  Is the cursor at the end of the data
  14.                                     (on the last record)
  15.  

cdbc

  • Hero Member
  • *****
  • Posts: 1496
    • http://www.cdbc.dk
Re: Get rid of DBNavigator ...
« Reply #1 on: August 11, 2024, 11:27:50 pm »
Hi
Skip the '.DataSet' in 'DbfContacts.DataSet.First();'. "DbfContacts" *is* the /dataset/  8)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

egsuh

  • Hero Member
  • *****
  • Posts: 1436
Re: Get rid of DBNavigator ...
« Reply #2 on: August 13, 2024, 10:35:06 am »
Quote
Skip the '.DataSet' in 'DbfContacts.DataSet.First();'. "DbfContacts" *is* the /dataset/

I agree. Your codes should work.

1HuntnMan

  • Full Member
  • ***
  • Posts: 240
  • From Delphi 7 to Lazarus
    • NewFound Photo Art
Re: Get rid of DBNavigator ...
« Reply #3 on: August 15, 2024, 07:43:00 pm »
Yup, leave out the DataSet, just DbfContacts.First(), DbfContacts.Prior(), DbfContacts.Last(), etc.

Thanks, the Lazarus TDbf Tutorial is wrong in their examples, see below:
Code: Pascal  [Select][+][-]
  1. Moving Thru Table Records
  2. (Jumping to Beginning of File, End of File, Next Record, Prior Record, etc.)
  3. DbfContacts.FilePathFull := '/home/somelocation/database_location/';   // Path to
  4.         the database directory
  5. DbfContacts.TableName := 'Contacts.dbf;    // database file (including extension)
  6. DbFContacts.Open;
  7. DbfContacts.DataSet.First();   // -> Go to the first record
  8. DbfContacts.DataSet.Prior();  // -> Go to the previous record
  9. DbfContacts.DataSet.Next();  //->  Go to the next record
  10. DbfContacts.DataSet.Last();  //->  Go to the last record
  11. DbfContacts.DataSet.BOF;  { Is the cursor at the beginning of the data
  12.                                     (on the first record) , returns boolean }
  13. DbfContacts.DataSet.EOF;  //->  Is the cursor at the end of the data
  14.                                     (on the last record)
  15.  

 

TinyPortal © 2005-2018