procedure TfrmGettingStarted.btnInsertClick(Sender: TObject); var iID: Integer; begin if not FDconnection1.Connected then Exit; // Insert a record 增 FDconnection1.ExecSQL('insert into Categories(CategoryName, Description, Picture) ' + 'values(:N, :D, :P)', ['New category', 'New description', $0334]); FDQuery1.Refresh; // Get a scalar value from DB, 查 iID := FDconnection1.ExecSQLScalar('select MAX(CategoryID) from Categories'); ca := 'Last CategoryID = ' + IntToStr(iID); end; procedure TfrmGettingStarted.btnUpdateClick(Sender: TObject); begin if not FDconnection1.Connected then Exit; // Update records 改 FDconnection1.ExecSQL('update Products set UnitPrice = UnitPrice * :P1 + :P2 ' + 'where ProductID < 3', [Random(5), Random(3)]); FDQuery2.Refresh; end; procedure TfrmGettingStarted.btnDeleteClick(Sender: TObject); begin if not FDconnection1.Connected then Exit; // Delete a record 删 FDconnection1.ExecSQL('delete from Categories where CategoryName like :N', ['New category']); FDQuery1.Refresh; end;
标签:语句,insert,20,FDconnection1,TObject,Connected,Exit,New From: https://www.cnblogs.com/tulater/p/18079731