表 A
create table A
(
S varchar(10)
)程序 Button1, Edit1, Edit2, InterBase连接
procedure TForm1.Button1Click(Sender: TObject);
begin
if Edit1.Text <> '' then
begin
Edit2.Text := Edit1.Text + ' '; //Edit2 多2个空格
with IBQuery1 do
begin
Close;
SQL.Clear;
SQL.Add(' insert into a (s) values(:s)');
ParamByName('s').AsString := Edit1.Text;
ExecSQL; Close;
SQL.Clear;
SQL.Add(' select * from A where s = :s');
ParamByName('s').AsString := Edit2.Text;
Open;
if RecordCount > 0 then
ShowMessage('一样!')
else
ShowMessage('不同!');
end;
end;
end;结果是‘一样!’!...InterBase的varchar有没有空格都一样吗?怎么改呢?
create table A
(
S varchar(10)
)程序 Button1, Edit1, Edit2, InterBase连接
procedure TForm1.Button1Click(Sender: TObject);
begin
if Edit1.Text <> '' then
begin
Edit2.Text := Edit1.Text + ' '; //Edit2 多2个空格
with IBQuery1 do
begin
Close;
SQL.Clear;
SQL.Add(' insert into a (s) values(:s)');
ParamByName('s').AsString := Edit1.Text;
ExecSQL; Close;
SQL.Clear;
SQL.Add(' select * from A where s = :s');
ParamByName('s').AsString := Edit2.Text;
Open;
if RecordCount > 0 then
ShowMessage('一样!')
else
ShowMessage('不同!');
end;
end;
end;结果是‘一样!’!...InterBase的varchar有没有空格都一样吗?怎么改呢?
例如你的数据是'aa '
你查询'aa'和 'aa '都能够查询的到的