procedure TfrmUser.btnQueryClick(Sender: TObject);
var
strCondition:string;
begin
inherited;
strCondition:='select * from public_czybm where czymc like '%+edit1.text+%'';
query.Close;
query.SQL.Text:=Self.strSelect+Self.strWhere+strCondition+strOrder;
query.Open;
end;
var
strCondition:string;
begin
inherited;
strCondition:='select * from public_czybm where czymc like '%+edit1.text+%'';
query.Close;
query.SQL.Text:=Self.strSelect+Self.strWhere+strCondition+strOrder;
query.Open;
end;
这句是错着的,应该写成:
'select * from public_czybm where czymc like '%''+edit1.text+''%''
其它几个字符串内容不知道!
str:='select * from public_czybm where czymc like ''%'+edit1.text+'%'''
quer.sql.add(str);
如果直接在query.sql.add()中增加可能会出错,没有测试!
这句是错着的,应该写成:
'select * from public_czybm where czymc like '%'+'''+edit1.text+'''+'%'