zoukankan      html  css  js  c++  java
  • (转载)ADOQuery参数传递

    ADOQuery参数传递

    dbgrid1.DataSource := datasource1;
    datasource1.DataSet := adoquery1;
    Value := 1221;
    SQL := 'SELECT * FROM customer WHERE CustNo>:Number';
    adoquery1.SQL.Clear;
    adoquery1.Parameters.Clear;
    adoquery1.sql.Add(SQL);
    // adoquery1.ParamCheck := true;
    adoquery1.Parameters.ParamByName('Number').Value := strtointdef(edit1.Text, 1);

    adoquery1.close;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select * from new where 1=1');
    adoquery1.SQL.Add('and 购货单位=:company');
    adoquery1.SQL.Add('and 品名=:name');
    adoquery1.Parameters[0].Value:=edit1.Text;
    adoquery1.Parameters[1].value:=edit2.Text;
    adoquery1.Open;
    应该成

    adoquery1.close;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select * from new where 1=1');
    adoquery1.SQL.Add('and 购货单位=:company');
    adoquery1.SQL.Add('and 品名=:name');
    adoquery1.Parameters.ParamValues['company']:=edit1.Text;
    adoquery1.Parameters.ParamValues['name']:=edit2.Text;
    adoquery1.Open;


    adoquery1.close;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select * from new where 1=1');
    adoquery1.SQL.Add('and 购货单位=:company');
    adoquery1.SQL.Add('and 品名=:name');
    adoquery1.Parameters.ParamByName(''company').value:=edit1.text;
    adoquery1.Parameters.ParamByName('name').value:=edit2.text;
    adoquery1.Open;

    http://www.delphibbs.com/keylife/iblog_show.asp?xid=22167

  • 相关阅读:
    SSDT
    SSDT
    Rootkit之SSDT hook(通过CR0)
    直接用编译器按ctrl+F5运行和双击运行结果不一样
    HDU 1754 I Hate It
    HDU 1166 敌兵布阵
    网易2017内推笔试题 合唱团
    CodeForces 1151F Sonya and Informatics
    CodeForces 1151E Number of Components
    洛谷 P1962 斐波那契数列
  • 原文地址:https://www.cnblogs.com/angelbd/p/3373141.html
Copyright © 2011-2022 走看看