Arsip: menghitung record dalam perulangan

 
user image
more 7 years ago

idhiel

para master delphi... gimana caranya menghitung jumlah record dalam perulangan? contoh kodenya kayak gini,,

begin
dm.Dbf2.Close;
dm.Dbf2.TableName := sedit1.Text ;
dm.Dbf2.FilePathFull := sedit2.Text ;
dm.Dbf2.Active := true;
dm.Dbf2.Open ;
dm.Dbf3.Active := true;
while NOT dm.Dbf2.Eof do
begin
  dm.Dbf3.Open ;
  dm.Dbf3.Append ;
  dm.Dbf3['noref'] := dm.Dbf2['noref'];
  dm.Dbf3['cycle'] := dm.Dbf2['cycle'];
  dm.Dbf3['nama'] := dm.Dbf2['nama'];
  dm.Dbf3['addrs'] := dm.Dbf2['alamat_1'];
  dm.Dbf3['addrs1'] := dm.Dbf2['alamat_2'];
  dm.Dbf3['city'] := dm.Dbf2['kota'];
  dm.Dbf3['kodepos'] := dm.Dbf2['kodepos'];
  dm.Dbf3['upload'] := dm.Dbf2['tglupl'];
  dm.Dbf3['bank'] := sedit3.Text ;
  dm.Dbf3['thome'] := dm.Dbf2['home_ph'];
  dm.Dbf3['tkantor'] := dm.Dbf2['off_ph'];
  dm.Dbf3['thp'] := dm.Dbf2['hp'];
  dm.Dbf3.Post ;
  dm.Dbf2.Next;
end;
end;
yg mau di hitung adalh jumlah record pada Dbf3 yg baru di import dari Dbf2 trim's atas bantuannya...
user image
more 7 years ago

cartrun

kalau mau menghitung jumlah record pake perintah SQL z gan. kurang lebih perintah untuk menghitung jumlah record tuh seperti ini. Select Count * From Dbf3;
user image
more 7 years ago

idhiel

klo perintah itu gan tuk menghitung seluruh jumlah record yg ada di dbf3.. nah klo mau menghitung jumlah record yg masuk pada saat looping tadi gimana gan..? mohon bantuannya...
user image
more 7 years ago

mas_kofa


x := 0;
begin looping
   inc(x);
end looping
user image
more 7 years ago

idhiel

lalu gimana jika jumlah record dari hasil looping tadi mau di tampilkan dalam sebuah label atau edit teks.. mohon bantuannya lagi mas... klo bisa diberikan contoh dengan kode yg paling atas mas...
user image
more 7 years ago

alhass

[quote="idhiel"]para master delphi... Buat variabel dl misal

var jumlah:integer;
begin
jumlah:0;
dm.Dbf2.Close;
dm.Dbf2.TableName := sedit1.Text ;
dm.Dbf2.FilePathFull := sedit2.Text ;
dm.Dbf2.Active := true;
dm.Dbf2.Open ;
dm.Dbf3.Active := true;
while NOT dm.Dbf2.Eof do
begin
  dm.Dbf3.Open ;
  dm.Dbf3.Append ;
  dm.Dbf3['noref'] := dm.Dbf2['noref'];
  dm.Dbf3['cycle'] := dm.Dbf2['cycle'];
  dm.Dbf3['nama'] := dm.Dbf2['nama'];
  dm.Dbf3['addrs'] := dm.Dbf2['alamat_1'];
  dm.Dbf3['addrs1'] := dm.Dbf2['alamat_2'];
  dm.Dbf3['city'] := dm.Dbf2['kota'];
  dm.Dbf3['kodepos'] := dm.Dbf2['kodepos'];
  dm.Dbf3['upload'] := dm.Dbf2['tglupl'];
  dm.Dbf3['bank'] := sedit3.Text ;
  dm.Dbf3['thome'] := dm.Dbf2['home_ph'];
  dm.Dbf3['tkantor'] := dm.Dbf2['off_ph'];
  dm.Dbf3['thp'] := dm.Dbf2['hp'];
  dm.Dbf3.Post ;
  jumlah:=jumlah+1;
  dm.Dbf2.Next;
end;
label1.caption:=intToStr(jumlah);
end;
Begitu kira2 kl dimasukkan ke coding-mu
user image
more 7 years ago

idhiel

maksih banyak agan Alhass... codingnya dah aq coba n berhasil...berhasil...berhasil.. :D :D :D :D
more ...
  • Pages:
  • 1
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com