![]() |
Re: Couldn't convert varient of type (NULL) into type (Strin
Setz doch einen Breakpoint auf die Zeile mit 'Wer' und geh dann mit F7 weiter
|
Re: Couldn't convert varient of type (NULL) into type (Strin
OK, deine Funktion arbeitet das Programm komplett durch.
Aber dann wenn es in die nächste Zeile zum Schreiben des Codes aus 'hcode2' geht meckert er rum. Davor macht er alles ganz normal. |
Re: Couldn't convert varient of type (NULL) into type (Strin
Was wird zurückgegeben?
|
Re: Couldn't convert varient of type (NULL) into type (Strin
Siehe Topic. ;)
|
Re: Couldn't convert varient of type (NULL) into type (Strin
Nein, was liefert meine Funktion zurück, wenn du ihr eine Null-Feld übergibst?
|
Re: Couldn't convert varient of type (NULL) into type (Strin
Über die Breakpoints, was du mir grade gesagt hast, kommt gar nichts zurück, bis eben der genannte Fehler auftritt.
|
Re: Couldn't convert varient of type (NULL) into type (Strin
Aber du solltest im Einzelschrittmodus sehen, in welchen Zweig der If-Anweisung er verzweigt.
|
Re: Couldn't convert varient of type (NULL) into type (Strin
Sorry, wenn ich irgendwas verpasst habe, aber wieso ersetzt Du nicht
Delphi-Quellcode:
durch
Query.FieldValues['xxx']
Delphi-Quellcode:
Dann hast Du die Probleme doch erst gar nicht. :gruebel:
Query.FieldByName('xxx').AsString
|
Re: Couldn't convert varient of type (NULL) into type (Strin
Hallo,
ich möchte noch eine Lanze für die PageProducer-Komponenten brechen. Hier wäre eine Gelegenheit für den Einsatz von TDataSetPageProducer. Einfach das HTML-Template zuweisen:
XML-Code:
Und ein kleines Stück Code:<tr> <td width=9% bgcolor=#666666><font color=#FFFFFF size=2 face=Arial> <#FIELD name=KLASSEN></font></td> <td width=9% bgcolor=#666666><font color=#FFFFFF size=2 face=Arial> <#FIELD name=S></font></td> <td width=9% bgcolor=#666666><font color=#FFFFFF size=2 face=Arial> <#FIELD name=FUER></font></td> <td width=9% bgcolor=#666666><font color=#FFFFFF size=2 face=Arial> <#FIELD name=WER></font></td> <td width=9% bgcolor=#666666><font color=#FFFFFF size=2 face=Arial> <#FIELD name=FACH</font></td> <td width=9% bgcolor=#666666><font color=#FFFFFF size=2 face=Arial> <#FIELD name=RAUM></font></td> <td width=37% bgcolor=#666666><font color=#FFFFFF size=2 face=Arial> <#FIELD name=BEMER_SCH></font></td> </tr>
Delphi-Quellcode:
So richtig gut wird das ganze mit verketteten Producern.
procedure TDataModel.DataSetPageProducerHTMLTag(Sender: TObject; Tag: TTag;
const TagString: String; TagParams: TStrings; var ReplaceText: String); var fldName: string; producer: TDataSetPageProducer; begin producer := Sender as TDataSetPageProducer; if (Tag = tgCustom) and SameText(TagString, 'FIELD') then begin fldName := TagParams.Values['name']; if Assigned(producer.DataSet.Fields.FindField(fldName)) then ReplaceText := VarToStr(producer.DataSet.FieldValues[fldName]) else ReplaceText := Format('[?%s]', [fldName]); end; end; { ... } procedure TDemoForm.ButtonClick(Sender: TObject); begin with DataModel do begin Query.Open; while not Query.Eof do begin Memo.Lines.Add(DataSetPageProducer.Content); Query.Next; end; Query.Close; end; end; Darüber meditieren ihr solltet. Gute Nacht |
Re: Couldn't convert varient of type (NULL) into type (Strin
Liste der Anhänge anzeigen (Anzahl: 1)
Zitat:
Immerhin ist der Fehler schonmal weg. Wie bekomme ich es nun noch hin, dass nicht immer nur das selbe geschrieben wird, sondern jede Zeile auch das, was dafür in der Tabelle steht? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:10 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