Failed to update records in a table
Posted: Thu 26 Nov 2009 16:13
Hi,
I would like to update student data with the following codesnippets, but it would throw out the message said 'Update failed. Found 0 records', but as the showmessage showed, there was a record existed!
====codesnippets====
with TUniTable.Create(nil) do
try
Connection := conSQLite;
TableName := 'Student';
Filtered := False;
Filter := 'Ref=' + IntToStr(StudentRef);
Filtered := True;
Active := True;
try
ShowMessage(IntToStr(RecordCount )); // 1
Edit;
FieldByName('FullName').AsString := FullName;
//......
Post;
Result := True;
except
Result := False;
MessageDlg('Failed to save modification!', mtError, [mbOK], 0);
end;
finally
Close;
Free;
end;
I would like to update student data with the following codesnippets, but it would throw out the message said 'Update failed. Found 0 records', but as the showmessage showed, there was a record existed!
====codesnippets====
with TUniTable.Create(nil) do
try
Connection := conSQLite;
TableName := 'Student';
Filtered := False;
Filter := 'Ref=' + IntToStr(StudentRef);
Filtered := True;
Active := True;
try
ShowMessage(IntToStr(RecordCount )); // 1
Edit;
FieldByName('FullName').AsString := FullName;
//......
Post;
Result := True;
except
Result := False;
MessageDlg('Failed to save modification!', mtError, [mbOK], 0);
end;
finally
Close;
Free;
end;