A aven Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-02 #1 在数据库中,查找对象时,如何把下拉列表框的值,当作查找值查找。代码写一下。
P parable Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-02 #2 把Table的Filtered 设为TRUE 在Combobox的ONchange中加入: procedure TForm1.ComboBox1Change(Sender: TObject); begin table1.close; table1.filter:='name='+''''+combobox1.text+''''; //其中name为要查找的字段名,combobox1.text为和它匹配的值. table1.open; end;
把Table的Filtered 设为TRUE 在Combobox的ONchange中加入: procedure TForm1.ComboBox1Change(Sender: TObject); begin table1.close; table1.filter:='name='+''''+combobox1.text+''''; //其中name为要查找的字段名,combobox1.text为和它匹配的值. table1.open; end;
J jingrunx Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-02 #3 (C++Builder Code) Table1->Filter = "Name = '" + ComboBox1->Text + "'"; Table1->FindFirst(); return true or false
(C++Builder Code) Table1->Filter = "Name = '" + ComboBox1->Text + "'"; Table1->FindFirst(); return true or false
P plwei Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-02 #4 在combobox的onchange事件中: with query1 do begin close; sql.clear; sql.add('select * from my.db where yourfield='+combobox1.text); open; end;
在combobox的onchange事件中: with query1 do begin close; sql.clear; sql.add('select * from my.db where yourfield='+combobox1.text); open; end;
P plwei Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-04 #6 那就将上述代码写以事件:onkeydown中 if key=VK_RETURN then with query1 do begin close; sql.clear; sql.add('select * from my.db where yourfield='+combobox1.text); open; end;
那就将上述代码写以事件:onkeydown中 if key=VK_RETURN then with query1 do begin close; sql.clear; sql.add('select * from my.db where yourfield='+combobox1.text); open; end;
A aven Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-06 #7 不好意思,又来了。为何上述代码运行后, Grid中只剩一项找到的值,我想让表像查找前一样显示。另外,table1.filter:='name='+''''+combobox1.text+'''';中的"" ""有何用
不好意思,又来了。为何上述代码运行后, Grid中只剩一项找到的值,我想让表像查找前一样显示。另外,table1.filter:='name='+''''+combobox1.text+'''';中的"" ""有何用
A arm Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-06 #8 if key=VK_RETURN then with query1 do begin locate('yourfield',combobox1.text); end;
A aven Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-07 #9 还有个小问题^=^ 在为query的Sql写代码时,点了Code Editor后,如何恢复。