Arsip: menampilkan tanggal tertentu pada perintah Query...
more 13 years ago
uron
wahai para Master...tolong donk minta bantuannya.
aq nulis kode buat memfilter tanggal tertentu sperti dibwh ini.
pengennya jika aq mau nampilkan data hanya dari tgl 01/01/2000 s/d 30/01/2000
,
yang tampil ya cuma data brdasarkan tgl itu aja.
var
s: string;
begin
QUERY1.Close;
s:= ' SELECT * FROM TblJual WHERE '+
' Tanggal between '+quotedstr(formatdatetime('dd/mm/yyyy',DateTimePicker1.DateTime))+
' AND '+quotedstr(formatdatetime('dd/mm/yyyy',DateTimePicker2.DateTime));
query1.SQL.Text:=s;
QUERY1.Open;
end;
tapi jika kode diatas dijalankan, hasil yg ditampilkan kok cuma berdasarkan tanggal aja knapa ya???
contohnya gini, kbetulan pada tabel tsb hanya mnyimpan data dari periode tgl 01/01/2000 s/d tgl. 01/30/2000 saja.
tapi...pas aq coba tentukan bdsarkan periode tgl 01/02/2000 s/d 28/02/2000 (yg jelas2 data pada tgl tsb blm ada)...
yg keluar adl periode pada tgl 01/01/2000 s/d 28/01/2000. kyknya parameter bulan dan tahun kok ga' kebaca knp ya??
pgn aq sih hasilnya kosong kl pas q pgn nampilin data pada bulan Februari...please ya master2...bantuin aq. Makasih bgt sblumnya :-)
more 13 years ago
uron
udah q rubah sperti ini ttp sama aja knp ya?? yg salah dimana??
var
s : String;
begin
s:= ' SELECT * FROM Fee WHERE '+
' Tanggal between '+quotedstr(formatdatetime('dd/MM/yyyy',DTP1.DateTime))+
' AND '+quotedstr(formatdatetime('dd/MM/yyyy',DTP2.DateTime));
QUERY1.Close;
QUERY1.SQL.Clear;
query1.SQL.Add(s);
QUERY1.Open;
end;
more 13 years ago
delphi_warrior
Dicoba dulu di databasenya...
kalo bisa...baru lewat delphi...
Good Luck
more 13 years ago
echo_crazz
SQL.Query.Add('where tanggal between '+QuotedStr(FormatDateTime('yyyy/mm/dd',DateTimePicker1.Date))+'and'+QuotedStr(FormatDateTime('yyyy/mm/dd',DateTimePicker2.Date))+'');
Moga membantu..
more 13 years ago
didinsino
format tanggal di database dan di datetimepicker harus disamain dulu. coba yang ini:
ADOQuery1.close;
ADOQuery1.SQL.Text:='SELECT * FROM namatabel ' +
'WHERE FORMAT(tanggal, "dd/mm/yyyy") ' +
'BETWEEN "' +FormatDateTime('dd/mm/yyyy',Datetimepicker1.Date)+ '" ' +
'AND "' +FormatDateTime('dd/mm/yyyy',Datetimepicker2.Date)+ '"';
ADOQuery1.Open;
moga2 bisa membantu..
more 13 years ago
uron
ADOQuery1.close;
ADOQuery1.SQL.Text:='SELECT * FROM TblJUAL ' +
'WHERE FORMAT(Tanggal, "dd/mm/yyyy") ' +
'BETWEEN "' +FormatDateTime('dd/mm/yyyy',DTP1.Date)+ '" ' +
'AND "' +FormatDateTime('dd/mm/yyyy',DTP2.Date)+ '"';
ADOQuery1.Open;
kode diatas emg sih bs jalan, tp efeknya ttp aja parameter "bulan" dan "tahun" ttp ga kebaca....hadeuuwwh :-( gmn donk boz,,,,
more ...
- Pages:
- 1
reply |
Report Obsolete
Last Articles
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 4 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 5 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 12 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 12 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 12 years ago
Random Topic
- Disable Ctrl + Alt + Delete dan Alt + TAB di Win XP,2000
by IdrisZZ in Hal umum tentang Pascal Indonesia more 17 years ago - database (suspect) ???
by flamade in MsSQL more 17 years ago - Teknik Client-Sever Buat Koneksi Ke Finger Print
by ikhsan_pratama in Network, Files, I/O & System more 17 years ago - Masalah dengan file smscomp.pas neh
by p2bf in Tip n Trik Pemrograman more 17 years ago - cari file sms.DLL
by nurez in Network, Files, I/O & System more 16 years ago - delphi-id banyak perubahan mendasar ya.......
by EkoIndri in OOT more 17 years ago - mysql & sql server 2000
by marvel in Network, Files, I/O & System more 18 years ago - Deteksi aplikasi di develop pakei apa.
by bosenjadiprogrammer in Enginering more 18 years ago - [Postgre]: Apa kelebihan n kekurangannya?
by deLogic in FireBird more 18 years ago - cari component
by alfian in Enginering more 19 years ago