Missing SQL property问题,请帮忙找明原因,谢谢!
procedureTcjadd_Form.CmdOKClick(Sender:TObject);varksbh,kscj,kmmc,sqlstr:string;begin...
procedure Tcjadd_Form.CmdOKClick(Sender: TObject);
var
ksbh,kscj,kmmc,sqlstr:string;
begin
ksbh:=trim(ksbh_LEdit.Text);
kscj:=trim(cj_LEdit.Text);
if strtofloat(kscj) < 0 then
begin
ShowMessage('请输入考生考试成绩');
exit;
end;
if kmmc_CBox.ItemIndex < 0 then
begin
Showmessage('请选择科目名称');
exit;
end;
kmmc:= trim(kmmc_CBox.Text);
sqlstr:='insert into t_cjb(ksbh,kmmc,kscj) values ("'+ksbh+'","'+kmmc+'","'+kscj+'")';
with TADOQuery.Create(nil) do
begin
try
Close;
Connection:=main_Form.ADOConnection1;
SQL.Clear;
SQL.Add('select * from t_cjb where (ksbh="'+ksbh+'") and (kmmc="'+kmmc+'")');
SQL.Clear;
Open;
if recordcount > 0 then
begin
Showmessage('该科目的成绩已经输入,请选择其他科目成绩输入!');
exit;
end
else
begin
Close;
SQL.Clear;
SQL.Add('insert into t_cjb(ksbh,kmmc,kscj) values ("'+ksbh+'","'+kmmc+'","'+kscj+'")');//(sqlstr);
ExecSQL;
end;
finally
Free;
end;
end;
end; 展开
var
ksbh,kscj,kmmc,sqlstr:string;
begin
ksbh:=trim(ksbh_LEdit.Text);
kscj:=trim(cj_LEdit.Text);
if strtofloat(kscj) < 0 then
begin
ShowMessage('请输入考生考试成绩');
exit;
end;
if kmmc_CBox.ItemIndex < 0 then
begin
Showmessage('请选择科目名称');
exit;
end;
kmmc:= trim(kmmc_CBox.Text);
sqlstr:='insert into t_cjb(ksbh,kmmc,kscj) values ("'+ksbh+'","'+kmmc+'","'+kscj+'")';
with TADOQuery.Create(nil) do
begin
try
Close;
Connection:=main_Form.ADOConnection1;
SQL.Clear;
SQL.Add('select * from t_cjb where (ksbh="'+ksbh+'") and (kmmc="'+kmmc+'")');
SQL.Clear;
Open;
if recordcount > 0 then
begin
Showmessage('该科目的成绩已经输入,请选择其他科目成绩输入!');
exit;
end
else
begin
Close;
SQL.Clear;
SQL.Add('insert into t_cjb(ksbh,kmmc,kscj) values ("'+ksbh+'","'+kmmc+'","'+kscj+'")');//(sqlstr);
ExecSQL;
end;
finally
Free;
end;
end;
end; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询