buttonclick事件
var
a,s:string;
begin
a:= edit1.text;
adoquery1.close;
adoquery1.sql.clear;
s:= 'select   '+a+ 'from jobs'; 
adoquery1.open;
end;
//为什么我运行的时候说什么找不到存储过程,该怎么修改
我打算把EDIT1。TEXT当变量传进SQL中去

解决方案 »

  1.   

    what is your a?? if it's a field there write:ADOQuery.SQL.Add('select ' + a + ' from jobs');
      

  2.   

    select 后面要跟字段列表,你所输入的edit1.text的内容是什么呢?必须是字段名列表的形式
      

  3.   

    buttonclick事件
    begin
      if trim().text = '' then Exit;
      with adoquery1 do
      begin
        close;
        SQL.Clear;
        SQL.Add('select ' + trim().text + ' from jobs');
        try
          open
        except
          Application.messageBox('查询错误!','Error',16);
        end;
      end;
    end;其实,你可以跟踪一下,取出你构造的sql语句。然后在explorer里执行一下。就知道错误了。