PDA

View Full Version : Errorنامعلوم به خاطر یه Post



heroma
شنبه 12 شهریور 1384, 21:02 عصر
برنامه درست موقع Post یکError:Key violation میده. لطفا یک بگویید چرا؟ من همه جاشو چک کردم یا دوباره نوشتم ولی...
کدش رو نوشتم تو سوال قبلم .







procedure TForm12.BitBtn2Click(Sender: TObject);
var
j,p,k,m:integer;
begin
while table2.Eof<>true and (k<>10) do
begin
if table1.FieldByName('Number').value=table2.FieldByN ame('Number').value then
k:=10
else table2.Next;
end;
while table3.eof<>true and (p<>10) do
begin
if table1.FieldByName('Membering Number').value=table3.FieldByName('Membering Number').Value then
p:=10
else table3.Next;
end;
if p<>10 then
begin
form15.Show; form11.Close;
end;
if k<>10 then
begin
form19.Show; form11.Close;
end;
if (p=10) and (k=10) then
begin
if table2.FieldByName('Amanat').value=true then
form11.Show;
if table3.FieldByName('Books').value>=3 then
form11.Show;
if table2.FieldByName('Amanat').value=false and (table3.FieldByName('Books').value<3) then
begin
table2.Edit;
table3.Edit;
table2.FieldByName('Amanat').value:=true;
table3.FieldByName('Books').value:=table3.FieldByN ame('Books').value+1;
if table2.FieldByName('Amanat').value=true then form19.Show;
table1.Active:=true;
table1.Post;
end;
end;
end;

Mahdi_S_T
یک شنبه 13 شهریور 1384, 06:35 صبح
همانطور که می دانید اگه فیلدی رو به عنوان کلید اصلی تعریف کنید نباید دو مقدار مساوی داشته باشد و یا مقدار خالی داشت باشد احتمالا شما یکی از این دو اشتباه را انجام داده اید