I tried to open my tables in Delphi with the following code:
for I := 0 to Datamodule1.ComponentCount - 1 do
if Datamodule1.Components[I] is TADOTable then
Begin
TADOTable(datamodule1.Components[i]).EDIT;
End;
But when I want to post it gives me an error that the tables is not in EDIT or INSERT mode. What have I done wrong here?
Thanks for the feedback. I have managed to solve the problem. Before i set the table in the edit mode state, I firts check the state, as I have already put the table in edit state before calling this procedure
for I := 0 to Datamodule1.ComponentCount - 1 do
if Datamodule1.Components[I] is TADOTable then
Begin
if not (TADOTable(datamodule1.Components[i]).State in [dsEdit]) then
TADOTable(datamodule1.Components[i]).EDIT;
End;