AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Update/Delete Record items in a Stream

Ein Thema von mandoza · begonnen am 27. Apr 2018 · letzter Beitrag vom 28. Apr 2018
 
mandoza

Registriert seit: 27. Apr 2018
16 Beiträge
 
#7

AW: Update/Delete Record items in a Stream

  Alt 27. Apr 2018, 11:55
Can you post your real code? Your current LoadFromStream() and SaveToStream() appear to be testing routines because they contain syntax errors and, in their current form, do not make sense:

In LoadFromStream() you load your data into a local variable myRec . After that, your procedure ends and myRec is gone. You can inspect myRec in the debugger, but in the end, this method accomplishes nothing.

"Real code" would, for example, take an instance of TMyrecord and a filename as parameters for LoadFromStream() and SaveToStream()
Thank you , i don't have an issue with LoadFromStream() and SaveToStream() , because i'll use my Rec else where , my issue now is with updating MyRec value then save it again ( at same stream position ) . thank you again

Delphi-Quellcode:
procedure UpdateMyRecLastName(NewLastName:string);
var
  LoadingStream: TFileStream;
  i, j: Integer;
  myRec:Tmyrecord;
begin
  SavingStream := TFileStream.Create('SAVE.test', fmCreate or fmOpenWrite or fmShareDenyWrite);
  try
       myRec.LastName := ReadStringFromStream(SavingStream); // load the OLD value
       myRec.LastName:=NewLastName; // update it
      
      {
    Here how to update myRec.LastName value in the LoadingStream
      }

    
  finally
    SavingStream.Free;
  end;
end;

Geändert von mandoza (27. Apr 2018 um 11:59 Uhr)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:49 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz