MyTable - Error trying to edit records
Posted: Wed 12 Oct 2011 09:52
Firstly, let me apologise if this topic has been covered before elsewhere. I have searched but been unable to find information I require.
I am a newcomer to MySQL as I have always found the BDE to do everthing I wanted.
I am attempting to edit and add data to a table but keep getting an 'Update failed. Found 0 records' error when trying to edit a record that should already exist.
Am obviously doing something stupid but need help.
Delphi 2007, Win 7 64-bit
Code fragment:
with MyTable1 do
begin
TableName := 'm10';
SQL.Clear;
Open;
rc := RecordCount;
Last;
if flag or (rc = 0) then
Append
else
Edit;
flag := False;
FieldByName('Date_Time').AsDateTime := dt;
FieldByName('Count').AsInteger := Count[2];
for c := 1 to 32 do
FieldByName('ch'+IntToStr(c)).AsFloat := Average[c];
Post;
Close;
end;
Any help would be appreciated. Thank you in advance.
I am a newcomer to MySQL as I have always found the BDE to do everthing I wanted.
I am attempting to edit and add data to a table but keep getting an 'Update failed. Found 0 records' error when trying to edit a record that should already exist.
Am obviously doing something stupid but need help.
Delphi 2007, Win 7 64-bit
Code fragment:
with MyTable1 do
begin
TableName := 'm10';
SQL.Clear;
Open;
rc := RecordCount;
Last;
if flag or (rc = 0) then
Append
else
Edit;
flag := False;
FieldByName('Date_Time').AsDateTime := dt;
FieldByName('Count').AsInteger := Count[2];
for c := 1 to 32 do
FieldByName('ch'+IntToStr(c)).AsFloat := Average[c];
Post;
Close;
end;
Any help would be appreciated. Thank you in advance.