Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Blob-Inhalt in Memo-Feld schreiben (https://www.delphipraxis.net/40922-blob-inhalt-memo-feld-schreiben.html)

Christian123 23. Feb 2005 09:56


Blob-Inhalt in Memo-Feld schreiben
 
Hallo!
Folgende Problematik:
Für ein kleines Notizzettel-Programm will ich Inhalte aus einem Memo-Feld einer Form in eine Paradox-Tabelle abspeichern. Als Datentyp hab ich für den Memo-Inhalt "M" (Memo-Blob) in der Datenbanktabelle gewählt.

Folgender Code scheint nicht zu funktionieren (Fürs neue Speichern einer Notiz):
Delphi-Quellcode:
  table2.Append;
  table2['Notiz'] := memo1.Lines.Text;
  table2.Refresh;
Folgender Code klappt auch nicht fürs auslesen:
Delphi-Quellcode:
   strquery := 'select * from Notiz where betreff = "' + node.Text + '";' ;
            query1.SQL.Clear;
            query1.sql.Add(strquery);
            query1.Active := true;
            query1.first;
           //Folgende Zeile verurtsacht einen Fehler: Ungültiuge Variant-Operation!
            memo1.Lines.Add(query1['Notiz'].asstring);
Die Paradox-Tabelle "Notiz" ist folgendermaßen aufgebaut: id + (Increment)
betreff A(255)
Notiz M(240)

Die Form hat jeweils eine Table-, DataSource und Query-Komponennte.

Vielen Dank für die Hilfe!!!

[edit=Sharky]Delphi-Tags eingefügt. Mfg, Sharky[/edit]

Albi 23. Feb 2005 10:41

Re: Blob-Inhalt in Memo-Feld schreiben
 
Hallo,

ich habe das so realisiert

Code:
With Table2 Do
Begin
  Edit;
  Append;
  FieldByName('Notiz').AsString:= Memo1.Text;
  Post;
end;
Wenn Du kein Post setzt, werden die Daten bei dem Refresh ja wieder verworfen. Also somit nicht in die DB geschrieben.

Christian123 23. Feb 2005 11:09

Re: Blob-Inhalt in Memo-Feld schreiben
 
Besten Dank!
Hat super geklappt :)!!


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:49 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz