Definately works. Always has in Pascal, thats one of the points (scope).

Dave.

-----Original Message-----
From: Mark Derricutt [mailto:[EMAIL PROTECTED]]
Sent: Friday, 3 November 2000 14:41
To: Multiple recipients of list delphi
Subject: [DUG]: procedures within procedures... and scope...


'llo, got a wee question on scope and procedures within procedures...

Take the following code:

procedure TformMain.Delete2Click(Sender: TObject);
var
  cs: TCommaSplitter;
  sSQL: string;
  sWhere: string;
  i: integer;

  procedure DeleteTestFromTable(sTable, sWhere: string);
  begin
    with dm.GDMQuery do
    begin
      Close;
      SQL.Text := Format('DELETE FROM %s D WHERE %s',[sTable, sWhere]);
      ExecSQL;
    end;
  end;

begin
  ....
end;

Now, I'm declaring sWhere in the Delete2Click routine, I was thinking that
it would be available to the DeleteTestFromTable() routine but it's not,
so I have to pass it in, or is there a way to reference that variable
without making it a form variable?

Mark





-- 
"We don't guarantee anything except that it will take up disk space..."
  Apache 2.0alpha5 Disclaimer

Now Playing: <no audio cd present>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to