我自定义了一个函数,在ComboBox中输入数据,存到表Comp_Pipe_Name的Pipe_Name字段中,存之前想判断一个数据库表里是否里已经存过这个记录,如没存过再存入。
procedure TInputDlg.ComboBox1Exit(Sender: TObject);
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.ComboBox1Exit then-----------------------感觉这里有问题
begin
SQL.Add('Insert Comp_Pipe_Name(Pipe_Name) Values(:a)');
Parameters.ParamByName('a').value:= InputDlg.ComboBox1.Text;
end;
end;
end;
编译出错:
[Error] digitizer_main.pas(295): Not enough actual parameters
请问你什么回事呢?
procedure TInputDlg.ComboBox1Exit(Sender: TObject);
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.ComboBox1Exit then-----------------------感觉这里有问题
begin
SQL.Add('Insert Comp_Pipe_Name(Pipe_Name) Values(:a)');
Parameters.ParamByName('a').value:= InputDlg.ComboBox1.Text;
end;
end;
end;
编译出错:
[Error] digitizer_main.pas(295): Not enough actual parameters
请问你什么回事呢?
解决方案 »
- Delphi Cxgrid如何有选择的导出到Excel
- 朋友的一個問題,很長的程序...
- 怎麼得到 當前是第幾季度?delphi中沒有這個時間函數呀?
- 紧急求助!
- 需求Asyc profasional控件,提供下载地址也行!!!
- 在delphi里用query怎样删除表和建立表。在线!!!!!111
- 调用窗体的OnClose事件,能关闭窗体吗,能的话,如何调用?
- 用memo读文体
- 大侠们好!小弟请问如何实现WINDOWS的F3查找功能??
- ADODateSet1.FieldByName('成绩').AsFloat:=60;如果我想让成绩等于NULL该怎么写?
- 关于数据库表格存入数据的小问题!
- 关于Windows系统服务的问题
[Error] digitizer_main.pas(295): Type of expression must be BOOLEAN;
还有个错误[Error] digitizer_main.pas(292): Undeclared identifier: 'SQL',就是在主程序的第5行,怎么可能没定义呢,很不明白,请高手帮助解答