procedure TForm1.Button4Click(Sender: TObject);begin
adoquery2.SQL.Clear;
adoquery2.Close;
adoquery2.sql.Text:=('select * from 表 where 字段1=:V or 字段2 =:v');
adoquery2.parameters.parambyname('V').value :=edit3.Text;
adoquery2.Open;
end;end.
只有字段1起作用
写法是不是和VB什么的不一样呢?
adoquery2.SQL.Clear;
adoquery2.Close;
adoquery2.sql.Text:=('select * from 表 where 字段1=:V or 字段2 =:v');
adoquery2.parameters.parambyname('V').value :=edit3.Text;
adoquery2.Open;
end;end.
只有字段1起作用
写法是不是和VB什么的不一样呢?
begin
adoquery2.Close;
adoquery2.SQL.Clear;
adoquery2.sql.add( 'select * from 表 where 字段1=:V or 字段2 =:v ');
adoquery2.parameters.parambyname( 'V ').value :=edit3.Text;
adoquery2.Open;
end;
end.
sql语句没什么问题。。
procedure TForm1.Button4Click(Sender: TObject);
begin
adoquery2.SQL.Clear;
adoquery2.Close;
adoquery2.sql.Text:=( 'select * from 表 where (字段1=:V) or (字段2 =:v) ');
adoquery2.parameters.parambyname( 'V ').value :=edit3.Text;
adoquery2.Open;
end;