[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2158
  • Last Modified:

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.
0
brettawv
Asked:
brettawv
  • 3
  • 2
  • 2
1 Solution
 
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
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now