如题
比方说:
var
vanriat :sing;
xh:string;
begin
xh:=adoquery2.fieldvalues['型号'].astring;
adoquery1.sql.add('select '''+vanriat+'''=长度 from aa where 型号='''+xh+'''');//可不可
adoquery1.open;
end;另外可不可以用存取过程获得所需的值(用adostoredproc).//怎样写?
谢谢!

解决方案 »

  1.   

    更正下错误:
    1.vanriat :string;
    2.没有这种写法:xh:=adoquery2.fieldvalues['型号'].astring;
    要写成这样:xh:=adoquery2.fieldvalues['型号'];
    或者xh:=adoquery2.FieldByName('型号').astring;
    3.adoquery1.sql.add('select '''+vanriat+'''=长度 from aa where 型号='''+xh+'''');//这种取值是错误的,不可用的
    4.另外执行SQL语句,你的adoquery1要close并且clear一下错误太多,这么短的代码,汗!!
      

  2.   

    --create
    create proc PrTest
    @chvParam1 varchar(10),
    @chvParam2 varchar(20)
    as
    begin
      --your operation
      select ....
    end--use
    exec Pr_Test
    exec