954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

EDBEngineError 'Operation Not Applicable'

Hi there,

I'm having some real issues with restoring a piece of legacy software at my workplace.

I have an offending line of code that I can't debug.

bFound := tblComp.Locate('CompPhone;Title;AddLine2', VarArrayof([sPhone, sTitle, sAddLine2]), [])


When the script gets to this point sPhone, sTitle and sAddLine2 are correctly populated.

When it gets to this line it throws the above error: Project XXX.exe raised exception class EDBEngineError with message 'Operation Not Applicable'

If anyone has any pointers of why this might be happening or how to go about solving the issue that would be great.

Thanks, Bernie.

berniefitz
Light Poster
36 posts since Jul 2011
Reputation Points: 17
Solved Threads: 7
 

Hi Bernie and welcome to DaniWeb :)

That code looks fine, can you move the creation of your variant array outside the function and step into the Locate to see exactly where the error occurs?

VarArray := VarArrayOf([sPhone, sTitle, sAddLine2]);
bFound := tblComp.Locate('CompPhone;Title;AddLine2', VarArray, []); // <- step in here using debugger
darkagn
Veteran Poster
1,197 posts since Aug 2007
Reputation Points: 404
Solved Threads: 200
 

Hi there,

Thanks for the response. I broke down the statement and when debugging I get to the same error. However, looking closer I can see that the exception is handled, it's just that I want to know why the exception is being thrown so that I can adapt the program.

//Check if this Company has been added to the Company Table
    try
        VarArray := VarArrayOf([sPhone, sTitle, sAddLine2]);
        bFound := tblComp.Locate('CompPhone;Title;AddLine2', VarArray, []); // <- step in here using debugger
        //bFound := tblComp.Locate('CompPhone;Title;AddLine2', VarArrayof([sPhone, sTitle, sAddLine2]), [])

        except on EDBEngineError do
            bFound := False;
    end; //trying
berniefitz
Light Poster
36 posts since Jul 2011
Reputation Points: 17
Solved Threads: 7
 

What DB are you using, what is the class of tblComp and what are the types for the fields you are using in locate and types of the variables (string?) ?
Some possible reasons:
- if sAddLine2 type is BLOB it would explain the error (you cannot locate using blob fields).
- if the datatype of the variables (sPhone, sTitle, sAddLine2) doesn't match the column data types.
- On some databases case of the column name might be significant (CompPhone vs COMPPHONE) even if Delphi doesn't think so.

Mikav6
Newbie Poster
16 posts since Jun 2009
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: