Forum > Databases

[SOLVED]Update large batch of records keeps, stop exception at different points

(1/2) > >>

What I can do:
Window 10@64bit
Lazarus 3.2
Database MS Jeti with *.mdb format
Problem: big data base with 3650+ records
need to update all the records on two fields that always change

field Order is integer
field bal is float

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---//...............Type  TCheckRowData =Record                   r:integer;                   n:string;                   d:TDate;      //chkDate                   p:string;                   m:String;                   pr:String;    //CHKPurpose                   Db:Real;      //chkDebit                   cl:String;    //CHKCL                   cr:Real;      //CHKDep                   b:real;       //chkBal                   o:integer;    //CHKOrder                  end;VAR chk:TCheckRowData;         //...............Procedure TForm1.ReadCHKRec;begin with DBGrid2.DataSource.Dataset do  begin   CHK.r:=RecNo;   CHK.n:=FieldByName('CK_Num').AsAnsiString;   CHK.d:=TRUNC(FieldByName('CK_Date').AsDateTime);   CHK.p:=FieldByName('CK_PaidTo').AsAnsiString;   CHK.m:=FieldByName('CK_Memo').AsAnsiString;   CHK.pr:=FieldByName('CK_Purpose').AsAnsiString;   CHK.Db:=FieldByName('CK_Debit').AsFloat;   CHK.cl:=LeftStr(FieldByName('CK_CLR').AsAnsiString,1);   CHK.cr:=FieldByName('CK_Dep').AsFloat;   CHK.b:=FieldByName('CK_Bal').AsFloat;   CHK.o:=FieldByName('ck_Order').AsInteger;  end;end;//...............procedure TForm1.DoRunUpdate(aStart: integer);var o,x,r:Integer; b:real;begin// DBGrid2.BeginUpdate;   SQLEventsActive(false);  //turn off all events on Query and Dataset aStart:=aStart+32; if aStart>DBGrid2.DataSource.DataSet.RecordCount then  aStart:=DBGrid2.DataSource.DataSet.RecordCount;{sorted Desend so most current on top} for x:=aStart downto 1 do  begin   DBGrid2.DataSource.DataSet.RecNo:=x; //---------------------sometime stop exception here   ReadCHKRec;   r:=CHK.r;   if x=aStart then     begin      if r=x then       begin        b:=CHK.cr-CHK.Db;        o:=0;       end     else      begin       b:=CHK.b;       o:=CHK.o;      end;     end   else     begin      b:=b+CHK.cr-CHK.Db;      o:=o+OrderSpace;      DBGrid2.DataSource.DataSet.Edit;      DBGrid2.DataSource.DataSet.FieldByName('CK_Bal').AsFloat:=b;      DBGrid2.DataSource.DataSet.FieldByName('ck_Order').AsInteger:=o;      if DBGrid2.DataSource.DataSet.State in [dsInsert,dsEdit] then       DBGrid2.DataSource.DataSet.Post; //-------------------sometimes stop exception here      CHKSQLQuery.ApplyUpdates;      //CHKSQLQuery.Close;      SQLTransaction1.CommitRetaining;     end;   DBGrid2.Refresh;  end;// DBGrid2.EndUpdate;  DBGrid2.DataSource.DataSet.RecNo:=r; SQLEventsActive(TRUE);end;

I have tested the errors and checked the RecNo and it stops at different records processing cycles and errors out at aroun 145~271 range of processed records.

Get this error........

the search results so far talk more about one or a few records but not a big batch.

Handoko:
I am not sure if it still applies now but in the past I frequently had problems with Access mdb database, a simply compact and repair always fixed the problems.

What I can do:
Hey Handoko, Greetings...

--- Quote ---a simply compact and repair
--- End quote ---
:D is that some sort of Pascal code procedure or SQL scrip, or a painful reminder with the consequences of using outdated engines.
...you still made me smile.

Can this be done with script, or a Component Set installed.
or is this the Big SQL3 engine rewrite...

Handoko:
To do the compact and repair, start the Microsoft Access. In the menu, you can find the Compact and Repair.

Can it be done using a script or component?
I am not sure. I have abandoned Access database for a very long time, if I remember correctly last time I used it was in 2000.

What I can do:
OK, I tested a few SQL3 one labeled in the examples but it turned out to be DBase. I found a online package but it crashed my system so hard I had to remove and install lazarus again.
What do you suggest as a package and or examples to learn from.

Navigation

[0] Message Index

[#] Next page

Go to full version