Checking If Table Is In Edit Mode

How can you tell if a database table is already in edit mode, before putting it in edit mode.
brettawvAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aubsCommented:
Hi Brettawy

You can use see the satate of a database table with the state property

  if Table1.State = dsEdit then...


Look up database state on the Delphi online help for other states.

Regards

Aubs
0
LischkeCommented:
Use:

  if NyTable.State <> dsEdit then
  begin
    ..
  end;

Ciao, Mike
0
LischkeCommented:
Oops, sorry Aubs. I didn't see your comment when I posted my answer...

Ciao, Mike
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

aubsCommented:
Sorry, massive typos

You can use the state of a database table with the state property

  if Table1.State = dsEdit then...

or maybe for your needs:

  if not(Table1.State = dsEdit) then
    table1.Edit;

I'm not quite sure why you want to do this. Normally you would check whether the table is in browse mode:

procedure TableEditClick(Sender: TObject);
begin
  if Table1.State = dsBrowse then
    table1.Edit
  else if (Table1.State = dsEdit) OR (Table1.State = dsInsert)  then
    table.post;//or table1.Cancel;

end;


Look up database state on the Delphi online help for other states.

Regards

Aubs
0
brettawvAuthor Commented:
How do I give aubs credit for his answer.
0
brettawvAuthor Commented:
How do I give aubs credit for his answer.
0
aubsCommented:
Hi Brettawy

Just Accept this as an answer!

Aubs
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.