Talk:Lazarus Tdbf Tutorial: Difference between revisions

From Free Pascal wiki
Jump to navigationJump to search
No edit summary
(Please ask questions on the forum or mailing list)
 
(10 intermediate revisions by 6 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
--[[User:BigChimp|BigChimp]] 15:58, 9 February 2013 (UTC)
  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>

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)