您的位置:首页 > 产品设计 > UI/UE

保存流 出现错误:[FireDAC][Phys]-329. Cannot generate update query. WHERE condition is empty

2016-09-23 18:31 555 查看
procedure SaveData(const Key: Integer; Stream: TMemoryStream);
var db: TFDQuery;
begin
db := TFDQuery.Create(nil);

try
db.Connection := Connection;
db.SQL.Text   := 'SELECT [' + fnData + '] FROM [' + tbOutpatientCards + '] '+
'WHERE [' + fnKey + '] = ' + IntToStr(Key);
db.Open;

if db.RecordCount > 0 then
begin
db.Edit;
(db.FieldByName(fnData) as TBlobField).LoadFromStream(Stream);
db.Post;
end;
finally
db.Free;
end;
end;
当执行上面的代码时,出现错误:[FireDAC][Phys]-329. Cannot generate update query. WHERE condition is empty
处理方法:在SELECT语句中增加主键字段
db.SQL.Text   := 'SELECT [' + fnKey + '] , [' + fnData + '] FROM [' + tbOutpatientCards + '] '+  'WHERE [' + fnKey + '] = ' + IntToStr(Key);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐