Searching pada Delphi

Searching: findnearest // tidak sama persis
tbbarang.indexname:=’namabrg’;
ada:=tbbarang.findnearest([edcari.text])

Searching: findkey // sama persis
tbbarang.indexname:=’namabrg’;
ada:=tbbarang.findkey([edcari.text])
if ada then
begin
tbbarang.edit;
tbbarang[‘stock’]:=tbbarang.text;
end;

Searching majemuk:
var caritgl:tdate;
begin
tbbeli.indexname:=’kdbrgtgl’; // index majemuk
try
begin
caritgl:=strtodate(edtgl.text);
tbbeli.findkey([edkodebrg.text, caritgl]);
end
except
tbbeli.findkey([edkodebrg.text]);
end;
end;

delete tabel:
tbtemp.first;
while not tbtemp.eof do
begin
tbtemp.delete;
end;

Append tabel;
begin
for i=1 to 10 do
begin
tbtemp.append;
tbtemp[‘kodebrg’]:=’ ‘;
tbtemp.post;
end;
end;

Advertisements

2 thoughts on “Searching pada Delphi

  1. wah artikelnya bagus banget…, seperti apa yg saya butuhkan.
    tapi gmn ya kalau mencari nilai dari field tertentu, yang di tentukan oleh 2 index pencarian??? kemudian nilai field yang di cari itu disimpan di variabel a.
    tolong kasi clue nya…., thanks b4.
    BSP:mohon kasus konkret nya…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s