Difference between revisions of "Talk:Lazarus Tdbf Tutorial"

From Free Pascal wiki
Jump to navigationJump to search
(newbie to this wiki and lazarus question)
(Please ask questions on the forum or mailing list)
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
The following code
+
This article is turning into a mix between a tutorial and a documentation page. I'd be fine with somebody splitting it up but it's not high enough on my priority list to bother myself right now.
<code>
 
var
 
  MyDbf: TDbf;
 
begin
 
  try
 
    MyDbf := TDbf.Create(nil);
 
    { use relative path to "data" directory }
 
    // etc ..
 
    MyDbf.Close;
 
  finally
 
    MyDbf.Free;
 
  end;
 
end;
 
</code>
 
should have the Create statement outsite of the try .. finally construct. Because when something goes wrong with the creation what has been created will be automatically freed. (At least this way it is in Delphi)
 
So I would advise to change to code to
 
<code>
 
var
 
  MyDbf: TDbf;
 
begin
 
  MyDbf := TDbf.Create(nil);
 
  try
 
    { use relative path to "data" directory }
 
    //etc.
 
</code>
 
  
 
+
--[[User:BigChimp|BigChimp]] 15:58, 9 February 2013 (UTC)
------
 
'''Reenen''': Hi there... My previous wiki experience was a more 'loose' forum like experience, so please forgive if I break any rules.
 
 
 
 
 
I just downloaded Lazarus yesterday (18 April 2005), and I am trying to teach myself a bit more of it.
 
 
 
 
 
So here I am trying to do this tutorial.  At first I didn't have the tdbf component on my component bar.  But I managed to find it on my installation and get it compiled and installed.  (You might want to add how to do this into the tutorial, but as it is a tdbf tut, and not lazarus, it's your call)
 
 
 
 
 
Then I started to create my database... (I also downloaded the demo from tdbf's website, but this didn't work, but I assume it's a Delphi demo.
 
 
 
 
 
I read in the tutorial that we cannot create a table in a database desktop like thing, so we have to code.
 
 
 
 
 
This is where I ran into trouble.
 
 
 
<code>
 
procedure TMainForm.btnCreateDatabaseClick(Sender: TObject);
 
begin
 
    dbCardData.TableLevel := 7;
 
    dbCardData.TableName := 'Cards';
 
    with dbCardData.FieldDefs do  begin
 
        Add('CardName',ftString,256,True);
 
        Add('Edition',ftString,128,True);
 
        Add('CC',ftString,32,True);
 
</code>
 
 
 
My error was
 
mainUnit.pas(56,24) Error: Identifier not found "ftString"
 
 
 
 
 
Can anyone help me?
 

Latest revision as of 10:36, 7 May 2014

This article is turning into a mix between a tutorial and a documentation page. I'd be fine with somebody splitting it up but it's not high enough on my priority list to bother myself right now.

--BigChimp 15:58, 9 February 2013 (UTC)