Jump to content
bazzer747

Naming FireDac Connection Weird

Recommended Posts

Hi

When I use a Firedac TFDConnection I normally rename it from the given (FDConnection1) name to something like 'fdc', I usually rename components to be the same amongst all my projects.

 

However, when I did this on my latest project I cannot use something like:

 

fdc.Connected:= True;

 

I get an 'undeclared identifier: 'Connected'' error when compiling'. I rename it back to 'FDConnection1' and 'FDConnection1.Connected:= True;' compiles fine.

 

Any thoughts as to why this might be?

Share this post


Link to post

self.fdc.connected works!

 

Got it! The procedure I use for this code is called

 

procedure ConnectLiveTest( fdc: String );

 

So that is the 'local variable'! I renamed it to 

 

procedure ConnectLiveTest( svr: String );

 

And can now use fdc.connected:= True; as I want to.

 

Thanks for the info.

Share this post


Link to post
  • Tip 1:
    • Don't skimp on letters when naming things! be explicit!
  • Tip 2:
    • Do not exaggerate! everything has a limit!

In Delphi, 31 chars it's ok for names! but you can use so much more these days!

Edited by programmerdelphi2k

Share this post


Link to post

Hi

On the subject of not skimping on names, I see too many code examples where the length of variables are unnecessarily way to long. I always create my variables to as short as possible, making sure they tell me something about what type they are and what they are used for. Makes code easier to read and understand. Most I use are local to the procedure, and any unit wide or global (very few and resisted) are named appropriately.

Share this post


Link to post

each one with your solutions, not?

what is better for a team?

  • iTot : integer;   // ref to total of object of class TButtons
  • or
  • LButtonCounting:integer; 
  • or
  • fdc:string;
  • fdc:FDConnection;
Edited by programmerdelphi2k

Share this post


Link to post

Whichever tells me enough about it's purpose (or the teams, if a team is involved). I often will write copious comments explaining what might be complex code.

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

×