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: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100:
| procedure TFSend.Download; begin try idFTP1.Host := ########; idFTP1.User := #########; idFTP1.Password := '#########;
idftp1.connect; idftp1.ChangeDir('mainwebsite_html'); idftp1.ChangeDir('arztsms'); idftp1.Get('sms.db' , 'sms_old.db', True); idftp1.disconnect; Update; except idftp1.disconnect; if MessageDlg('Fehler bei Datenbankübertragung - nochmal versuchen?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin download; end else begin Close; end; end; end;
procedure TFSend.Update; begin try SMS.Active:= False; SMS.SQL.Clear; SMS.SQL.Add('Select * from sms'); SMS.active:= True;
if SMS.RecordCount <> 0 then begin SMS.First; while not SMS.eof do begin // Prüfen ob schon im Web SMS2.Active:= False; SMS2.SQl.Clear; SMS2.SQL.Add('Select * from sms_old where (Nr = ''' + SMS.FieldByName('Nr').AsString + ''') and (Text = ''' + SMS.FieldByName('Text').AsString + ''') and (Datum = ''' + SMS.FieldByName('Datum').AsString + ''')'); SMS2.Active:= True;
// Wenn nicht, hinzufügen! if SMS2.RecordCount = 0 then begin SMS2.Active:= False; SMS2.SQl.Clear; SMS2.SQL.Add('Insert into sms_old values (''' + SMS.FieldByName('Nr').AsString + ''', ''' + SMS.FieldByName('Text').AsString + ''', ''' + SMS.FieldByName('KID').AsString + ''', ''' + SMS.FieldByName('Datum').AsString + ''')'); SMS2.ExecSQL; end; SMS.Next; end;
// alte Daten löschen SMS2.Active:= False; SMS2.SQl.Clear; SMS2.SQL.Add('Delete from sms_old where (Datum <= ''' + DateToStr(Date) + ''')'); SMS2.ExecSQL; end; Upload; except if MessageDlg('Fehler bei Datenbankübertragung - nochmal versuchen?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin download; end else begin Close; end; end; end;
procedure TFSend.Upload; begin try idFTP1.Host := ########; idFTP1.User := #########; idFTP1.Password := '#########';
idftp1.connect; idftp1.ChangeDir('mainwebsite_html'); idftp1.ChangeDir('arztsms'); idftp1.put('sms_old.db' , 'sms.db', False); uploadok:= True; idftp1.disconnect; except idftp1.disconnect; if MessageDlg('Fehler bei Datenbankübertragung - nochmal versuchen?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin download; end else begin Close; end; end; end; |