πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.database.dotnet
Article #609

Reserved word problem with Procedure

#609
From: Jon Kaumheimer
Date: Tue, 09 Nov 2004 15:19
53 lines
2604 bytes
Hi,

I have built a procedure that log SqlException to windows EventLog.
Unfortunately Borlands Delphi8 compiler complains about my code...

I get the error: Identifier expected but 'PROCEDURE' found.

Is this a bug? I must be allowed to use the property 'Procedure' in the
class SqlError even thou procedure is a reserved word in Delphi, right?

HereοΏ½s my procedure code:
----------------------------------------------------------------------------
----------------
procedure TPatientOverview.LogSqlException(sqlex: SqlException);
var
  el: EventLog;
  enum: IEnumerator;
  sqle: SqlError;
  strMessage: &string;
begin
  el := EventLog.Create();
  el.Source := 'HCO Kohtao';

  strMessage := 'Exception Number: ' + Convert.ToString(sqlex.Number) +
                '(' + sqlex.Message + ') has occured';
  el.WriteEntry(strMessage);

  enum := sqlex.Errors.GetEnumerator;
  while enum.MoveNext do
  begin
    sqle := SqlError(enum.Current);

    strMessage := sqle.Procedure;

    strMessage := 'Message: ' + sqle.Message + Environment.NewLine +
                  'Number: ' + Convert.ToString(sqle.Number) +
Environment.NewLine +
                  'Procedure: ' + sqle.Procedure + Environment.NewLine +
                  'Server: ' + sqle.Server + Environment.NewLine +
                  'Source: ' + sqle.Source + Environment.NewLine +
                  'Severity: ' + sqle.Class + Environment.NewLine +
                  'LineNumber: ' + Convert.ToString(sqle.LineNumber) +
Environment.NewLine;

    el.WriteEntry(strMessage);
  end;
end;
----------------------------------------------------------------------------
----------------

Thankful for all input to this problem...

/Jon
Technical Details
Message-ID: <4190df48@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1effe6,a2541ca3bf466cc8,start
X-Google-Attributes: gid1effe6,public
X-Google-Language: ENGLISH,ASCII
Reply-To: "Jon Kaumheimer" <joen_kaumheimer@hotmail.com>
From: "Jon Kaumheimer" <joen_kaumheimer@hotmail.com>
Newsgroups: borland.public.delphi.database.dotnet
Subject: Reserved word problem with Procedure
Date: Tue, 9 Nov 2004 16:19:31 +0100
Lines: 55
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 81.216.10.3
Message-ID: <4190df48@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1100013384 81.216.10.3 (9 Nov 2004 07:16:24 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail