Y
yyjqtww
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm21.Button1Click(Sender: TObject);
begin
if edit3.text='' then
begin
Messagedlg('请输入书号¡',mterror,[mbok],0);
edit3.Focused;
exit;
end;
if edit9.text='' then
begin
Messagedlg('请输入数量¡',mterror,[mbok],0);
edit9.Focused;
exit;
end;
if edit10.text='' then
begin
Messagedlg('请输入教师姓名¡',mterror,[mbok],0);
edit10.Focused;
exit;
end;
if edit11.text='' then
begin
Messagedlg('请输入经手人¡',mterror,[mbok],0);
edit11.Focused;
exit;
end;
if edit12.text='' then
begin
Messagedlg('请输入领取日期¡',mterror,[mbok],0);
edit12.Focused;
exit;
end;
query1.Close;
query1.SQL.Clear;
query2.close;
query2.SQL.Clear;
str:='select isbn from yteacherlinshu where teachername = '+''''+edit10.text+''''+' and isbn= '+''''+edit3.text+''''+'';
query1.sql.add(str);
query1.Open;
if query1.RecordCount<>0 then
begin
MessageDlg('此教师已经领过此书,不得再领¡',mtError,[mbok],0);
edit3.SetFocus;
Exit;
end
else
begin
query2.Close;
query2.SQL.Clear;
str:='select isbn from ykucuntab where isbn='+''''+edit3.Text+''''+'';
query2.sql.add(str);
query2.Open;
if query2.RecordCount=0 then
begin
MessageDlg('库存中无此书¡',mtError,[mbok],0);
edit3.SetFocus;
Exit;
end;
end;
query1.Close;
query1.SQL.Clear;
str:='insert into yteacherlinshu values('+''''+edit1.Text+''''+','+''''+edit2.Text+''''+','+''''+edit3.Text+''''+','+''''+edit4.Text+''''+','+''''+edit5.Text+''''+','+''''+edit6.Text+''''+','+''''+edit7.Text+''''+','+''''+edit8.Text+''''+','+''''+edit9.Text+''''+','+''''+edit10.Text+''''+','+''''+edit11.Text+''''+','+''''+edit12.Text+''''+')';
query1.SQL.add(str);
query1.ExecSQL;
MessageDlg('完成领书¡',mtCustom,[mbok],0);
exit;
table1.Refresh;
try
with Query2 do
begin
Close;
SQL.Text := 'update ykucuntab set total=total-1 ' +
' where isbn like ''' + edit3.Text + '''';
ExecSQL;
end;
except
raise
end;
上面执行都正确,可就是ykucuntab表中的total不能减一?请问各位老师,这是为什么呢?谢谢?
end;
begin
if edit3.text='' then
begin
Messagedlg('请输入书号¡',mterror,[mbok],0);
edit3.Focused;
exit;
end;
if edit9.text='' then
begin
Messagedlg('请输入数量¡',mterror,[mbok],0);
edit9.Focused;
exit;
end;
if edit10.text='' then
begin
Messagedlg('请输入教师姓名¡',mterror,[mbok],0);
edit10.Focused;
exit;
end;
if edit11.text='' then
begin
Messagedlg('请输入经手人¡',mterror,[mbok],0);
edit11.Focused;
exit;
end;
if edit12.text='' then
begin
Messagedlg('请输入领取日期¡',mterror,[mbok],0);
edit12.Focused;
exit;
end;
query1.Close;
query1.SQL.Clear;
query2.close;
query2.SQL.Clear;
str:='select isbn from yteacherlinshu where teachername = '+''''+edit10.text+''''+' and isbn= '+''''+edit3.text+''''+'';
query1.sql.add(str);
query1.Open;
if query1.RecordCount<>0 then
begin
MessageDlg('此教师已经领过此书,不得再领¡',mtError,[mbok],0);
edit3.SetFocus;
Exit;
end
else
begin
query2.Close;
query2.SQL.Clear;
str:='select isbn from ykucuntab where isbn='+''''+edit3.Text+''''+'';
query2.sql.add(str);
query2.Open;
if query2.RecordCount=0 then
begin
MessageDlg('库存中无此书¡',mtError,[mbok],0);
edit3.SetFocus;
Exit;
end;
end;
query1.Close;
query1.SQL.Clear;
str:='insert into yteacherlinshu values('+''''+edit1.Text+''''+','+''''+edit2.Text+''''+','+''''+edit3.Text+''''+','+''''+edit4.Text+''''+','+''''+edit5.Text+''''+','+''''+edit6.Text+''''+','+''''+edit7.Text+''''+','+''''+edit8.Text+''''+','+''''+edit9.Text+''''+','+''''+edit10.Text+''''+','+''''+edit11.Text+''''+','+''''+edit12.Text+''''+')';
query1.SQL.add(str);
query1.ExecSQL;
MessageDlg('完成领书¡',mtCustom,[mbok],0);
exit;
table1.Refresh;
try
with Query2 do
begin
Close;
SQL.Text := 'update ykucuntab set total=total-1 ' +
' where isbn like ''' + edit3.Text + '''';
ExecSQL;
end;
except
raise
end;
上面执行都正确,可就是ykucuntab表中的total不能减一?请问各位老师,这是为什么呢?谢谢?
end;