Witajcie.
Chciałbym zrobić taką opcję - Edycja w bazie danych aby móc zastępować kilka wpisów w bazie danych.Do połączenia używam "Zeosa". Edycja/zamiana zawartości pól ma się odbywać poprzez okna "..Edit.Text". m1, m2, m3 itd. to nazwy utworzonych kolumn w tabeli a magazyn to nazwa tabeli. Kod się uruchamia ale występuje taki błąd: "Project1.exe raised exception class EDatabaseError with message 'ZQuery1: Parameter 'a' not found'. Use Step or Run to Continue. Process Stoped...." Nie mogę sobie z tym poradzić. Zależy mi by już przypisane ID zostało bez zmian. (bo usuwanie i tworzenie nowych wpisów działa super ale ID się zmienia), Na razie mam coś takiego:
try
if Form1.ZConnection1.Connected then
Form1.ZConnection1.Connected := False
else Form1.ZConnection1.Connected := True;
Form1.ZQuery1.Close;
Form1.ZQuery1.SQL.Add('REPLACE magazyn SET ''id= :i, m1= :a, m2= :b, m3= :c, m4= :d, m5= :e, m6= :f, m7= :g, m8= :h'' where id= :i');
Form1.ZQuery1.ParamByName('i').AsString := Form7.StatusBar1.Panels[1].Text;
Form1.ZQuery1.ParamByName('a').AsString := Form7.Edit1.Text;
Form1.ZQuery1.ParamByName('b').AsString := Form7.Edit2.Text;
Form1.ZQuery1.ParamByName('c').AsString := Form7.Edit3.Text;
Form1.ZQuery1.ParamByName('d').AsString := Form7.Edit4.Text;
Form1.ZQuery1.ParamByName('e').AsString := Form7.Edit5.Text;
Form1.ZQuery1.ParamByName('f').AsString := Form7.Edit6.Text;
Form1.ZQuery1.ParamByName('g').AsString := Form7.Edit7.Text;
Form1.ZQuery1.ParamByName('h').AsString := Form7.Edit8.Text;
Form1.ZQuery1.ExecSQL;
Form1.ZQuery1.Close;
Form1.ZQuery1.SQL.Clear;
Form7.Edit1.Clear;
Form7.Edit2.Clear;
Form7.Edit3.Clear;
Form7.Edit4.Clear;
Form7.Edit5.Clear;
Form7.Edit6.Clear;
Form7.Edit7.Clear;
Form7.Edit8.Clear;
except
Form1.StatusBar1.Panels[1].Text := 'Wystąpił błąd podczas edycji wybranej pozycji.';
end;
Form7.Close;
end;
Może wie ktoś gdzie jest błąd, albo ma pomysł jak rozwiązać taki problem z edycją pól w bazie danych?. Pozdrawiam.