单独写也许行但是下面就通不过说abm没定义
var
abm,asql:string;
begin
if (treeview1.Selected.parent=nil) then
begin
exit;
end;
abm:=copy(treeview1.selected.text,1,pos(' ',treeview1.selected.text));
with damo do
begin
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select * from s_spxx where spbh like 'abm%''); //变量用单引号
adoquery1.open;
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select * from s_spxx where spbh like :aaa);
adoquery1.Parameters.ParamByName('aaa').Value:=abm+'%';
adoquery1.open;