Arsip: Looping lagi...

 
user image
more 12 years ago

idhiel

Mohon petunjuk para master2... langsung aja pada masalahx aq ingin saat record2 di dbf2 di pindahkan ke dbf 3, jika ada record di field noref(dbf3) = record di field wbno(dbf2) maka dbf3 dalam posisi Edit & jika sebaliknya Append masalahx codex membuat aplikasi jadi Hank... kodex seperti ini

procedure TForm9.bii;
var jumlah : integer;
begin
jumlah := 0;
dm.Dbf2.Close ;
dm.Dbf2.TableName := sedit1.Text ;
dm.Dbf2.FilePath := sedit2.Text ;
dm.Dbf2.FilePathFull := sedit2.Text ;
dm.Dbf2.Active := true;
dm.Dbf3.Active := true;
while NOT dm.Dbf2.Eof do
begin
if dm.Dbf3.Locate('noref',dm.Dbf2['Wbno'],[]) then  <<=== Saya kira masalahx ada disini
begin
  dm.Dbf3.Edit ;
  dm.Dbf3['cycle'] := dm.Dbf2['cycle'];
  dm.Dbf3['nama'] := dm.Dbf2['nama'];
  dm.Dbf3['addrs'] := dm.Dbf2['addr'];
  dm.Dbf3['kodepos'] := dm.Dbf2['kodepos'];
  dm.Dbf3['upload'] := dm.Dbf2['Pudt'];
  dm.Dbf3['bank'] := sedit3.Text ;
  dm.Dbf3.Post ;
  end
   else
  begin
  dm.Dbf3.Open ;
  dm.Dbf3.Append ;
  dm.Dbf3['noref'] := dm.Dbf2['Wbno'];
  dm.Dbf3['cycle'] := dm.Dbf2['cycle'];
  dm.Dbf3['nama'] := dm.Dbf2['nama'];
  dm.Dbf3['addrs'] := dm.Dbf2['addr'];
  dm.Dbf3['kodepos'] := dm.Dbf2['kodepos'];
  dm.Dbf3['upload'] := dm.Dbf2['Pudt'];
  dm.Dbf3['bank'] := sedit3.Text ;
  dm.Dbf3.Post ;
  jumlah := jumlah + 1;
  dm.Dbf2.Next;
end;
slabelfx2.Caption := inttostr(jumlah);
dm.Dbf3.Refresh ;
end;
end;
mohon pencerahannx master...
user image
more 12 years ago

halimanh

ada infinite loop tuh di dalam while loopnya. if ... then begin ... ...nggak ada dm.Dbf2.Next; nya end else begin ... end;
@idhiel: Mohon petunjuk para master2... langsung aja pada masalahx aq ingin saat record2 di dbf2 di pindahkan ke dbf 3, jika ada record di field noref(dbf3) = record di field wbno(dbf2) maka dbf3 dalam posisi Edit & jika sebaliknya Append masalahx codex membuat aplikasi jadi Hank... kodex seperti ini

procedure TForm9.bii;
var jumlah : integer;
begin
jumlah := 0;
dm.Dbf2.Close ;
dm.Dbf2.TableName := sedit1.Text ;
dm.Dbf2.FilePath := sedit2.Text ;
dm.Dbf2.FilePathFull := sedit2.Text ;
dm.Dbf2.Active := true;
dm.Dbf3.Active := true;
while NOT dm.Dbf2.Eof do
begin
if dm.Dbf3.Locate('noref',dm.Dbf2['Wbno'],[]) then  <<=== Saya kira masalahx ada disini
begin
  dm.Dbf3.Edit ;
  dm.Dbf3['cycle'] := dm.Dbf2['cycle'];
  dm.Dbf3['nama'] := dm.Dbf2['nama'];
  dm.Dbf3['addrs'] := dm.Dbf2['addr'];
  dm.Dbf3['kodepos'] := dm.Dbf2['kodepos'];
  dm.Dbf3['upload'] := dm.Dbf2['Pudt'];
  dm.Dbf3['bank'] := sedit3.Text ;
  dm.Dbf3.Post ;
  end
   else
  begin
  dm.Dbf3.Open ;
  dm.Dbf3.Append ;
  dm.Dbf3['noref'] := dm.Dbf2['Wbno'];
  dm.Dbf3['cycle'] := dm.Dbf2['cycle'];
  dm.Dbf3['nama'] := dm.Dbf2['nama'];
  dm.Dbf3['addrs'] := dm.Dbf2['addr'];
  dm.Dbf3['kodepos'] := dm.Dbf2['kodepos'];
  dm.Dbf3['upload'] := dm.Dbf2['Pudt'];
  dm.Dbf3['bank'] := sedit3.Text ;
  dm.Dbf3.Post ;
  jumlah := jumlah + 1;
  dm.Dbf2.Next;
end;
slabelfx2.Caption := inttostr(jumlah);
dm.Dbf3.Refresh ;
end;
end;
mohon pencerahannx master...
user image
more 12 years ago

idhiel

aq dah tambahkan yg agan maksud, but kok jadi sangat lambat ya,,, walaupun dalam field noref dbf3 kagak ada yg sama dengan field Wbno dbf2.. kayaknya code ini kagak berfungsi

if dm.Dbf3.Locate('noref',dm.Dbf2['Wbno'],[]) then
kalau codex hanya seperti ini,maka proses jadi cepat

while NOT dm.Dbf2.Eof do
begin
dm.Dbf3.Open ;
  dm.Dbf3.Append ;
  dm.Dbf3['noref'] := dm.Dbf2['Wbno'];
  dm.Dbf3['cycle'] := dm.Dbf2['cycle'];
  dm.Dbf3['nama'] := dm.Dbf2['nama'];
  dm.Dbf3['addrs'] := dm.Dbf2['addr'];
  dm.Dbf3['kodepos'] := dm.Dbf2['kodepos'];
  dm.Dbf3['upload'] := dm.Dbf2['Pudt'];
  dm.Dbf3['bank'] := sedit3.Text ;
  dm.Dbf3.Post ;
  jumlah := jumlah + 1;
  dm.Dbf2.Next;
end;
slabelfx2.Caption := inttostr(jumlah);
dm.Dbf3.Refresh ;
end;
user image
more 12 years ago

idhiel

aq dah tambahkan yg agan maksud, but kok jadi sangat lambat ya,,, walaupun dalam field noref dbf3 kagak ada yg sama dengan field Wbno dbf2.. kayaknya code ini kagak berfungsi

if dm.Dbf3.Locate('noref',dm.Dbf2['Wbno'],[]) then
kalau codex hanya seperti ini,maka proses jadi cepat

while NOT dm.Dbf2.Eof do
begin
dm.Dbf3.Open ;
  dm.Dbf3.Append ;
  dm.Dbf3['noref'] := dm.Dbf2['Wbno'];
  dm.Dbf3['cycle'] := dm.Dbf2['cycle'];
  dm.Dbf3['nama'] := dm.Dbf2['nama'];
  dm.Dbf3['addrs'] := dm.Dbf2['addr'];
  dm.Dbf3['kodepos'] := dm.Dbf2['kodepos'];
  dm.Dbf3['upload'] := dm.Dbf2['Pudt'];
  dm.Dbf3['bank'] := sedit3.Text ;
  dm.Dbf3.Post ;
  jumlah := jumlah + 1;
  dm.Dbf2.Next;
end;
slabelfx2.Caption := inttostr(jumlah);
dm.Dbf3.Refresh ;
end;
user image
more 12 years ago

halimanh

locate memang pelan. tabelnya di index nggak?
@idhiel: aq dah tambahkan yg agan maksud, but kok jadi sangat lambat ya,,, walaupun dalam field noref dbf3 kagak ada yg sama dengan field Wbno dbf2.. kayaknya code ini kagak berfungsi

if dm.Dbf3.Locate('noref',dm.Dbf2['Wbno'],[]) then
kalau codex hanya seperti ini,maka proses jadi cepat

while NOT dm.Dbf2.Eof do
begin
dm.Dbf3.Open ;
  dm.Dbf3.Append ;
  dm.Dbf3['noref'] := dm.Dbf2['Wbno'];
  dm.Dbf3['cycle'] := dm.Dbf2['cycle'];
  dm.Dbf3['nama'] := dm.Dbf2['nama'];
  dm.Dbf3['addrs'] := dm.Dbf2['addr'];
  dm.Dbf3['kodepos'] := dm.Dbf2['kodepos'];
  dm.Dbf3['upload'] := dm.Dbf2['Pudt'];
  dm.Dbf3['bank'] := sedit3.Text ;
  dm.Dbf3.Post ;
  jumlah := jumlah + 1;
  dm.Dbf2.Next;
end;
slabelfx2.Caption := inttostr(jumlah);
dm.Dbf3.Refresh ;
end;
user image
more 12 years ago

idhiel

kagak pake index gan... so klo mau yg cepat carax gimana..???
more ...
  • Pages:
  • 1
Share to

Random Topic

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