線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1193
推到 Plurk!
推到 Facebook!

請問DBLookupCombobox的顯示問題

尚未結案
Fen
一般會員


發表:18
回覆:17
積分:7
註冊:2003-10-20

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-04-05 14:10:46 IP:61.219.xxx.xxx 未訂閱
各位大大: 我要做一個通知人的欄位,而通知人是由資料庫中取出,我希望能做到在欄位上打通知人英文名字(UserId)的第一個字,及能跳到以其為字首的通知人,點選後,欄為中出現的通知人的中文名字(name)。下面是我的設定: DataSourse:DataSourceMaster DataField:issuer ListSourse:DataSource1 ListField:Name;UserId keyField:name ListFiledIndex:0
yachanga
資深會員


發表:24
回覆:335
積分:296
註冊:2003-09-27

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-04-05 18:00:11 IP:211.74.xxx.xxx 未訂閱
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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-04-06 08:38:24 IP:211.22.xxx.xxx 未訂閱
您好: 若使用lookupcombobox小弟有ㄍ變通辦法 就是在ListSourse上做手腳,ListSourse對應的DATASET使用query然後下如下的語法  
 select *,(eng_name '  ' chi_name) as eng_chi from XXX
如此一來,英文跟中文名稱都秀,且可以達到『能跳到以其為字首的通知人』 ~~應無所住而生其心~~
系統時間:2024-05-17 10:50:27
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!