Autor Beitrag
rubooo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52

WIN XP
Delphi 2005 Prof
BeitragVerfasst: Di 13.05.08 15:36 
Fehlermeldung
" ist kein gültiger Integerwert

Code-Abschnitt des Records:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
type
  TAuto = record
    id         : Integer;
    marke      : String[30];
    modell     : String[30];
    kategorie  : String[30];
    aufbau     : String[30];
    kmstand    : Double;
    kraftstoff : String[30];
    leistung   : Integer;
    getriebe   : String[30];
    farbe      : String[30];
    tueren     : Integer;
    sonstiges  : String[50];
    datumzeit  : TDateTime;
  end;


Code-Abschnitt Button speichern:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
procedure TForm1.bit_save_fileClick(Sender: TObject);
var i : Integer;
begin
  with SaveDialog1 do
  begin
    Filter := 'Dat-Dateien (*.dat)|*.dat';
    InitialDir := 'Beispieldateien';
    if Execute = True then
    begin
    FileName := Filename + '.dat';
    AssignFile(datei,FileName);
    Rewrite(datei);
    with sg_datenerfassung do
    begin
      for i := 1 to RowCount do
      begin
        daten.id         := StrToInt(Cells[1,i]);
        daten.marke      := Cells[2,i];
        daten.modell     := Cells[3,i];
        daten.kategorie  := Cells[4,i];
        daten.aufbau     := Cells[5,i];
        daten.kmstand    := StrToFloat(Cells[6,i]);
        daten.kraftstoff := Cells[7,i];
        daten.leistung   := StrToInt(Cells[8,i]);
        daten.getriebe   := Cells[9,i];
        daten.farbe      := Cells[10,i];
        daten.tueren     := StrToInt(Cells[11,i]);
        daten.sonstiges  := Cells[12,i];
        daten.datumzeit  := Now;
        Write(datei,daten);
      end;
    CloseFile(datei);
   end;
  end
  else Exit;
  end;
end;


er speicher die Werte sogar ab, aber spuckt jedesmal die Fehlermeldung aus, auch wenn alle Datentypen beachtet werden?!
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Di 13.05.08 15:41 
Dann ist wohl eine der Zellen, wo eigentlich in Integer drin stehen sollte, leer.
Bleiben zur Auswahl: 1, 8 oder 11.
rubooo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52

WIN XP
Delphi 2005 Prof
BeitragVerfasst: Di 13.05.08 15:46 
nein ich habe ja alles ausgefüllt.
das kann eig. nicht sein.
wie finde ich raus in welcher zeile? weil der speicher sogar die datei richtig ab, und diese lässt sich auch auslesen mit allen werten.
also eigentlich funktioniert das programm bis auf die fehlermeldung
rubooo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52

WIN XP
Delphi 2005 Prof
BeitragVerfasst: Di 13.05.08 15:50 
ohje hab den fehler ist ja logisch eigentlich!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
  for i := 1 to RowCount[b]-1[/b] do
      begin
        daten.id         := StrToInt(Cells[1,i]);
        daten.marke      := Cells[2,i];
        daten.modell     := Cells[3,i];
        daten.kategorie  := Cells[4,i];
        daten.aufbau     := Cells[5,i];
        daten.kmstand    := StrToFloat(Cells[6,i]);
        daten.kraftstoff := Cells[7,i];
        daten.leistung   := StrToInt(Cells[8,i]);
        daten.getriebe   := Cells[9,i];
        daten.farbe      := Cells[10,i];
        daten.tueren     := StrToInt(Cells[11,i]);
        daten.sonstiges  := Cells[12,i];
        daten.datumzeit  := Now;
        Write(datei,daten);
      end;
Fabian E.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 554

Windows 7 Ultimate
Visual Studio 2008 Pro, Visual Studion 2010 Ultimate
BeitragVerfasst: Di 13.05.08 16:53 
ohne mir den code jetzt genau anzusehen, würde ich sagen, dass du in der schleife dann die "1" noch durch eine "0" ersetzen musst.

gruß
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 13.05.08 17:05 
@user profile iconFabian E.:
Du vergisst die Fixed-Spalten bzw. Zeilen ;-).