E2066 Missing operator or semicolon error for NO reason

Posted on 2006-03-25
Last Modified: 2012-06-27
I have the following line of code.   If it is in my app, it will fail with the message: E2066 Missing operator or semicolon.  If the line is NOT there, it will compile fine.

Artist is a valid public string to the unit.  

if Length(artist) = 0 then artist := 'Unknown';

Why the heck is this happening?
Question by:hibbidiji
    LVL 31

    Expert Comment

    Without seeing a bigger excerpt of the code, it is difficult to advise.  On the face of it, there is no reason for it to fail.  Things to look at:

    Is artist or length being used in a different context to normal?  e.g. using artist as the unit name; using length as a variable, using either of these in a Const declaration.  Look for Includes in your code.

    What happens if you override the artist declaration by defining it within the function/procedure where this error is occurring?  (I know this will prevent the program from working correctly, but may give a clue where the problem is).
    LVL 22

    Expert Comment

    are you sure there's a semicolon before the line you wrote above?

    if you show few lines from your code, it will be easier to analyze your problem
    LVL 4

    Expert Comment

    I agree, more than likely the problem is with the line above, what's the chances you have a nested if statement / case statment just above?
    LVL 5

    Accepted Solution

    if Length(artist) = 0 then artist := 'Unknown';


    a : length(artist); //assign as integer (a)
    if a = 0 then artist := 'unknown';

    But ye it should work without doing this...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Title # Comments Views Activity
    Synchonize thread with form 14 87
    delphi custom sort exception 6 94
    Simple Delphi Question 9 68
    Virtuailstring tree compare node issue 14 75
    Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video discusses moving either the default database or any database to a new volume.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now