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

關於DateTimePicker

 
zch2002115
一般會員


發表:24
回覆:15
積分:7
註冊:2004-11-23

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-12-21 13:17:53 IP:211.96.xxx.xxx 未訂閱
此圖片中有4個DateTimePicker控件上下左右的順序名稱為DateTimePicker1,DateTimePicker2依次類推,我在“確定”按鈕中的代碼是    procedure Tqscxfrm.BitBtn1Click(Sender: TObject); var str,str2,str3,str4,str31,str41 : string ; begin str:=copy(formatdatetime('',DateTimePicker1.DateTime),1,10); str2:=copy(formatdatetime('',DateTimePicker2.DateTime),1,10); str3:=copy(formatdatetime('',DateTimePicker3.DateTime),11,14); str4:=copy(formatdatetime('',DateTimePicker4.DateTime),11,14); str31:=copy(str3,1,4); str41:=copy(str4,1,4); ShowMessage(str31); if str>str2 then begin ShowMessage('大於起始日期....'); exit; end; if str=str2 then begin if (str31='下') and (str41='上') then //(這一行並不往下執行,前提條件是,DateTimePicker3和DateTimePicker4 //分別顯示“下午..”“上午..” ) begin if str3 ShowMessage('大於起始時間....'); exit; end ; if str31=str41 then begin if str3=str4 then begin ShowMessage('申請日期時間不能相等...'); exit; end; if str3>str4 then ShowMessage('大於起始時間....'); exit; end ; end; ShowMessage(copy(formatdatetime('',DateTimePicker1.DateTime),1,10) copy(formatdatetime('',DateTimePicker3.DateTime),11,22)); ShowMessage(copy(formatdatetime('',DateTimePicker2.DateTime),1,10) copy(formatdatetime('',DateTimePicker4.DateTime),11,22)); with adoquery1 do begin close; sql.Clear; sql.Text:='select * from iqcsp where (sp01 like ''' edit1.Text '%'' or sp01 like ''' edit2.text '%'')'; sql.Text:=sql.Text 'and (sp02>=''' copy(formatdatetime('',DateTimePicker1.DateTime),1,10) copy(formatdatetime('',DateTimePicker3.DateTime),11,22) ''''; sql.Text:=sql.Text 'and sp02<=''' copy(formatdatetime('',DateTimePicker2.DateTime),1,10) copy(formatdatetime('',DateTimePicker4.DateTime),11,22) ''')'; open; ShowMessage(sql.text); if recordcount>0 then begin pinbypqs.ListBox1.Clear; while not eof do begin pinbypqs.ListBox1.Items.Add(fieldbyname('sp01').AsString); next; end; end; end; qscxfrm.Close; end;
系統時間:2024-05-01 13:05:50
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!