TFixedDataset help lazarus / 16-Databases ---------------------------------------------------------------------- WalterK · 2011-10-25 13:31 I'm trying to figure out TFixedDataset.  The example at http://wiki.freepascal.org/Lazarus_Database_Tutorial#Using_TSdfDataset _and_TFixedDataset doesn't show what units I need nor things like how FDataset was declared. I haven't found any other examples on the internet; not even documentation for TComponentsDatabase.  So I'm really in the dark. I need this (or another simple) database to put into a daemon-type process - no visual stuff or Lazarus in this program. (Using Laz on another part.) I basically clueless (and feeling more and more so as the months pass), so I was hoping someone could post a small but complete example. TIA. Walter ---------------------------------------------------------------------- felipemdc · 2011-10-25 13:39 I don't know anything about TFixedDataset, but I improved the example. It was really easy. It has this line of code:   FDataset := TSdfDataset.Create(nil); Then it is obvious that the declaration can only be: var   FDataset: TSdfDataset; The unit for that can be obtained in the Lazarus IDE. Go to the tab "Data Acess", right click the component for Sdf, and you get the unit: uses sdfdata; ---------------------------------------------------------------------- WalterK · 2011-10-25 14:12 Thanks. And I found that ftString is in the 'db' unit. That got me started with a small test program to build from. Thanks again. Walter ---------------------------------------------------------------------- WalterK · 2011-10-25 16:03 Cluelessness is back... I trying to find how one adds a record to a TsdfDataset (or a TFixedFormatDataset) and I ended up looking at  sfddata.pp through Laz: I don't see any functions to allow adding records.  Or search. Someone please straighten me out. TIA ---------------------------------------------------------------------- felipemdc · 2011-10-25 16:57 It is not supposed to contain any routines for doing stuff, it's base class, TDataset has them all. The idea is that you can change your dataset to another one, from a diferent database format and you don't have to change your code much, because the API is uniform. If you google for "freepascal TDataset" the first link is the documentation for TDataset http://www.freepascal.org/docs-html/fcl/db/tdataset.html I think that Insert is the method that you are looking for. ---------------------------------------------------------------------- WalterK · 2011-10-25 23:39 Thanks, but it doesn't even describe the interface (calling sequence).  I had to "google" to find what parameters InsertRecord took. Didn't Delphi have a component which took the record size and a compare function to implement some sort of database?  Hopefully that's disk-backed, but at this point it's not a requirement... ---------------------------------------------------------------------- felipemdc · 2011-10-26 02:28 Quote from: WalterK on October 26, 2011, 01:39:38 amThanks, but it doesn't even describe the interface (calling sequence). I had to "google" to find what parameters InsertRecord took. !? Did you try to just click on it? If you click in InsertRecord in the page that I showed you, it will go to: http://www.freepascal.org/docs-html/fcl/db/tdataset.insertrecord.html But it seams that InsertRecord is legacy stuff, like I said, you should use Insert I added an explenation and an example of how to use this here: http://wiki.lazarus.freepascal.org/Databases#Inserting_a_new_record ---------------------------------------------------------------------- WalterK · 2011-10-26 07:52 Yes, I see that now.  I obviously need to take a break from this because my brain is, plain to anyone, "fried." Thanks for the example.  I DO think more examples are good for those new to an area of freepascal (like databases).  There are enough examples in the RTL, for instance, but not much (that I've seen) elsewhere. Thanks for your help and patience and I'm sorry if I've been a bother. Easing off for a while... ---------------------------------------------------------------------- felipemdc · 2011-10-26 08:12 Quote from: WalterK on October 26, 2011, 09:52:27 amThanks for your help and patience and I'm sorry if I've been a bother. Not at all. The forum is for asking/answering stuff =)