2,507
社区成员




function TInputDlg.ValidCheck: boolean;
begin
Result := True;
with DataModule1.ADOquery1 do
begin
close;
sql.clear;
sql.add('select * from Comp_Pipe_Name where field =:Pipe_Name');
parameters.ParamByName('Pipe_Name').value:=combobox1.text;
open;
end;
if DataModule1.ADOquery1.recordcount>0 then
begin
Application.messagebox('已经输入过此数据','提示',0+mb_iconquestion) ;
combobox1.setfocus;
combobox1.text:='';
Result := False;
end;
end;
////////////////////////////////////////////
begin
if InputDlg.ShowModal = mrok then
begin
Close;
SQL.Clear;
with DataModule1.ADOQuery1 do
begin
if InputDlg.ValidCheck then
SQL.Add('Insert Comp_Pipe_Name(Pipe_Name) Values(:a)');
Parameters.ParamByName('a').value:= InputDlg.ComboBox1.Text;
ExecSQL;
end;
end;
end;