case ComboBox2.ItemIndex of
0: sign:='=';
1: sign:='>';
2: sign:='<';
3: sign:=' like ';
4: sign:='<>';
end;
case ComboBox1.ItemIndex of
0,4:fstr:='select * from Book_Info where(%s%s%s) order by %s';
19: fstr:='select * from Book_Info where(%s%s#%s#) order by %s';
else fstr:='select * from Book_Info where(%s%s''%s'') order by %s';
end;
with ADOQuery1 do
begin
SQL.Clear;
SQL.Add(Format(fstr,[ComboBox1.Text,sign,Edit1.Text,ComboBox1.Text]));
Prepared;
Open;
end;
请问上段代码的意思!还有0,4和19分别是什么意思?三个WHERE后的又是什么意思?谢谢!
0: sign:='=';
1: sign:='>';
2: sign:='<';
3: sign:=' like ';
4: sign:='<>';
end;
case ComboBox1.ItemIndex of
0,4:fstr:='select * from Book_Info where(%s%s%s) order by %s';
19: fstr:='select * from Book_Info where(%s%s#%s#) order by %s';
else fstr:='select * from Book_Info where(%s%s''%s'') order by %s';
end;
with ADOQuery1 do
begin
SQL.Clear;
SQL.Add(Format(fstr,[ComboBox1.Text,sign,Edit1.Text,ComboBox1.Text]));
Prepared;
Open;
end;
请问上段代码的意思!还有0,4和19分别是什么意思?三个WHERE后的又是什么意思?谢谢!
where后面是打印用的格式化字符
WHERE指的是查询语句的限定条件...
就是这个样子..
看些基础的书.都有说的..
where后面是查詢語句用的格式化字符串。()
fstr:='select * from Book_Info where(%s%s%s) order by %s';
Format(fstr,[ComboBox1.Text,sign,Edit1.Text,ComboBox1.Text])
如果ComboBox2.ItemIndex =0
運行后Fstr:='select * from Book_Info where combobox1.Items[combobox1.ItemIndex]=Edit1.Text order by combobox1.Items[combobox1.ItemIndex]'