Learn how to fix the Delphi error "Unable to find record. No Key specified”. This error happens when Delphi is unable to identify the primary key for your DataSet.
The code used in the presentation is:
for i := 0 to MyClientDataSet.Fields.Count - 1 do
begin
field := MyClientDataSet.Fields[ i ];
if i = 0 then
field.ProviderFlags := [ pfInUpdate, pfInWhere, pfInKey ]
else
field.ProviderFlags := [ pfInUpdate ];
fieldCopy := TField.Create( Self );
fieldCopy.ProviderFlags := field.ProviderFlags;
fieldCopy.FieldName := field.FieldName;
MyTSQLDataSet.Fields.Add( fieldCopy );
end;