[Lazarus] Easy to use memory dataset and TMemDataset problems

Aradeonas aradeonas at operamail.com
Fri Feb 26 11:06:38 CET 2016


Hi,

I want a memory dataset like VirtualTable [1]and really I cant
understand what are these bufdataset and memdataset and wiki[2] page as
I cant make bufdataset works without a file. I want an easy to sue
memory dataset without any file usage.

Yes there is a way to use TMemDataset like this as @Thaddy said:
> program memdbtest; {$apptype console}{$mode objfpc} uses  db,memds;
> var   MemDb:TMemDataset; begin MemDb:=TMemDataset.Create(nil); try
> MemDb.FieldDefs.Add('NAME',ftString,20);   MemDb.CreateTable;
> MemDb.Open;   MemDb.Append;   MemDb.FieldByName('NAME').Value:='Free';
> MemDb.Post;   MemDb.Append;
> MemDb.FieldByName('NAME').Value:='Pascal';   MemDb.Post;
> MemDb.SaveToFile('MemDb.txt');  // as long you do not close, you don't
> have to save finally   MemDb.Close;   MemDb.Free; end; end.
But as you can see it use memds unit that CodeTools has problem with
memds unit and also it will replace it with MemDataSet unit that has a
different TMemDataset without CreateTable option.

Also Wiki [3]says that BufDataset is a better choice but is it really?
and is it a choice for using as a memory dataset?how?

Regards, Ara



Links:

  1. https://www.devart.com/vtable/
  2. http://wiki.freepascal.org/How_to_write_in-memory_database_applications_in_Lazarus/FPC
  3. http://wiki.freepascal.org/How_to_write_in-memory_database_applications_in_Lazarus/FPC#Introduction

-- 
http://www.fastmail.com - Same, same, but different...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160226/0f5f6b02/attachment-0002.html>


More information about the Lazarus mailing list