没什么难度啊!
SQL='select * from '+table+' where field='+value

解决方案 »

  1.   

    query1.sql.clear;
    query1.sql.add('select * from table where'+'field'+'='+'value');
    query1.open;
      

  2.   

    可以这样
    因为TQuery也可以执行存储过程并返回记录集合
    可创建存储过程来实现你的要求
    使用如下语句
    exec 'select * from '+tablename +' where field='+value
      

  3.   

    这么写就行了:sql:='select * from '+''''+Table1+''''+' where Fields='+''''+Value+'''';
      

  4.   

    var  sTable,sVlaue.sSQL :string
    begin
    //Query.close
    Query.SQl.Clear;
    sSQL:='select * from '+sTable+' where field '+sValue ;
    query.SQL.add(sSQL);
    query.execsqlsValue 为字符串记得加引号
      

  5.   

    field和value在运行时都是是可变的。
      

  6.   

    很简单嘛!可以这样做啊
    var
      strSql: string;
    begin
      strSql='select * from '''+tablename+''' where field='+value
    // 这个时候就要看field的值类型了,如果是字符串用下面的
      strSql='select * from '''+tablename+''' where field='''+value+''''
    然后
      query1.sql.text := strSql;
      query1.open;
    即可
      

  7.   

    query1.sql.add('select * from table where'+'field'+'='+'value');
    中是否要加冒号?
      

  8.   

    嘻嘻query1.sql.add('select * from ' + #39 + tableEdit.Text + #39 +' where fieldName = :value');
    FieldByName('FieldName').AsString := ..;
    Open;
      

  9.   

    query1.sql.add('select * from table where'+'field'+'='+'value');
    肯定是错的
    query1.sql.add('select * from '+table+' where field='+value);

    (value为字符串)
    query1.sql.add('select * from '+table+' where field='''+value+'''');
      

  10.   

    query1.sql.add('select * from table where :fi=:va');
    query1.parambyname('fi'):=
    query1.parambyname('va'):=