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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
try
SQLTransaction1.StartTransaction; {Demmarre la transaction}
{Recherche le premier noeud}
NodesRecord := Content.FirstChild;
while NodesRecord <> nil do
begin
F_name := '';
F_note := '';
F_Op := '0';
F_Mode := '0';
F_Day := '0';
F_Top := '0';
{recuperation des donnees}
NodesName := NodesRecord.FindNode(FNameType);
if NodesName <> nil then
F_name := NodesName.TextContent;
NodesNote := NodesRecord.FindNode(FNoteType);
if NodesNote <> nil then
F_note := NodesNote.TextContent;
NodesOp := NodesRecord.FindNode(FOpType);
if NodesOp <> nil then
F_Op := NodesOp.TextContent;
NodesMode := NodesRecord.FindNode(FModeType);
if NodesMode <> nil then
F_Mode := NodesMode.TextContent;
NodesDay := NodesRecord.FindNode(FDayType);
if NodesDay <> nil then
F_Day := NodesDay.TextContent;
NodesTop := NodesRecord.FindNode(FTopType);
if NodesTop <> nil then
F_Top := NodesTop.TextContent;
F_name := QuotedStr(F_name);
F_note := QuotedStr(F_note);
try
TypeOperation := StrToInt(F_Op);
except
TypeOperation := 0;
end;
try
Modevalue := StrToInt(F_Mode);
except
Modevalue := 0;
end;
try
DayValue := StrToInt(F_Day);
except
DayValue := 0;
end;
if DayValue > 31 then
DayValue := 31;
try
Topvalue := StrToInt(F_Top);
except
Topvalue := 0;
end;
if Topvalue > 31 then
Topvalue := 31;
sSQL := Format('INSERT INTO T_TYPE(F_userparent, F_name, F_comment, F_optype, '+
'F_modevalue, F_dayvalue, F_topvalue) VALUES (%d, %s, %s, %d, %d, %d, %d)',
[user, F_name, F_note, TypeOperation, Modevalue, DayValue, Topvalue]);
DataModule1.SQLQuery1.SQL.Text := sSQL;
DataModule1.SQLQuery1.ExecSQL;
NodesRecord := NodesRecord.NextSibling;
end;
DataModule1.SQLTransaction1.Commit;
DataModule1.SQLTransaction1.EndTransaction; {Fin de la transacrion} |
Partager