Jump to content
bazzer747

Deleting a Field Problem

Recommended Posts

Hi,

 

I use MSSQL for my database and Firedac as an access method. I have a field called 'AccessLevel' in a table which is now redundant so I'm trying to remove it. I don't use this field anywhere in my project and a search in 'Find in Files' show's that it isn't referenced in any of the code.

 

Also, in the query I use to select all fields from the table it is in I have deleted the field from the Fields Editor.

 

I've renamed the field to 'AccessLevelX' in MSSQL Server (just in case!)

 

When I run the project I get an Exception EDatabseError in module .... Field 'AccessLevel' not found. I can only think there's a reference in the database module where the query exists, but if in the database module I try to 'View as Text' I get a message: 'Module 'nameof module.pas' has open descendants or linked modules. Cannot close'.

 

I'm not sure where I can go now, if someone has a thought as to a 'correct' procedure for removing unwanted/unused fields I'd appreciate some guidance.

 

Share this post


Link to post

I've opened the data module outside Delphi in Notepad++ and there's no reference to 'AccessLevel'. So I'm now confused why I'm getting and error message for a field that doesn't exist in the project (that I can find!)

Share this post


Link to post
Just now, Stano said:

I would also check the dfm file.

Extend that to all dfm files.

Share this post


Link to post

in rare moments this happens to me, then, I have a form that always works:

  • if necessary copy your SQL expression...
  • delete (not COPY/PASTE) the FDQuery, save the project, and re-add the FDQuery (new component)!

I think the reference is in the project's resource file, but I'm not sure as it's a binary file!   *.RES

Edited by programmerdelphi2k

Share this post


Link to post

it's rigth!  really if yourS forms had any reference these fields in "Design-time", for sure this can happens.

 

in my case, I had only 1 form... producing this anomaly

Edited by programmerdelphi2k

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×