Autor Beitrag
Killi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 299

Win*
D6 Prof
BeitragVerfasst: Do 14.08.03 10:08 
Hi!

Ich will eine SMS-Datenbank auf den Server schieben - besser egsagt immer aktualisieren! Deshalb lade ich zuerst die alte DB runter, prüfe dann welche Datensätze noch nicht vorhanden sind, hau die dann rein und schieb die neue DB wieder hoch....jetzt hab ich aber echt mal n Problem!
Es tut gar nichts (mehr, gestern tats wunderbar!!!!) - es bleiben noch alte Datensätze stehen obwohl ich schon per Hand eine LEERE DB hochgeschoben hab...hier mal der Code:
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:
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;
....?


Zuletzt bearbeitet von Killi am Do 14.08.03 15:58, insgesamt 1-mal bearbeitet
Killi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 299

Win*
D6 Prof
BeitragVerfasst: Do 14.08.03 11:41 
Jetzt gehts wieder - danke für eure Hilfe *g*...nee, macht nix, aber auf sowas zu kommen ist auch sch....!!! Die Endungen waren nur verratzt von meiner Datenbankoberfläche - die hat aus nem einfachen ".db" gleich ".DB" gemacht und so wurde die Datei per FTP nimmer gefunden!
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: Do 14.08.03 13:07 
Hi,

du solltest evl. die Usernamen und passwörter aus deinem Code entfernen :)
Killi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 299

Win*
D6 Prof
BeitragVerfasst: Do 14.08.03 15:58 
:shock: ach du meine fresse......thx :oops: