請問DBLookupCombobox的顯示問題 |
尚未結案
|
Fen
一般會員 發表:18 回覆:17 積分:7 註冊:2003-10-20 發送簡訊給我 |
|
yachanga
資深會員 發表:24 回覆:335 積分:296 註冊:2003-09-27 發送簡訊給我 |
Fen您好:
您希望"同一個欄位" 選完User ID後 顯示為對應的中文名字??
若要客製化,可用TComboBox DropDown and CloseUp事件完成...
供您參考 procedure TForm1.ComboBox1DropDown(Sender: TObject);
begin
query.Close;
query.sql.Text:='select * from table where user_id like '''+combobox1.text+'%'' or user_name like'''+combobox1.text+'%''';
query.Open;
combobox1.Clear;
while not query.Eof do
begin
combobox1.Items.Add(query.fieldbyName('user_id').AsString);
query2.Next;
end;
end; procedure TForm1.ComboBox1CloseUp(Sender: TObject);
Var
selectText,outText: String;
begin
selectText:=combobox1.Items.Strings[combobox1.itemindex];
if selectText<>'' then
begin
combobox1.Clear;
query.Close;
query.sql.Text:='select * from table where user_id= '''+selectText+'''';
query.Open; outText:=query.fieldbyName('user_name').AsString;
combobox1.Items.Add(outText);
combobox1.ItemIndex:=0;
end;
end; ~悠遊法國號~
|
terrychen
尊榮會員 發表:90 回覆:794 積分:501 註冊:2003-05-01 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |