Re: Copying from grid to Adotable



Thomas Willms explained on 18/10/2007 :
Hello,
I am using the procedure below to copy data from a stringgrid (beginning with the column (2fixed +) i3, line variable Min2) to an ACCESS Database (shown in a DBGrid).

[Snip...]

Ok lets put thing in to perspective first.

1) Coping values from a string grid to any Dataset requires that
1) the formating of dates, float numbers and time are persistent
through all the grid it self.
2) The formating machies the Localization settings on the computer.

You can easelly mach the locale settings with the formating on the grid by changing the global variables DecimalSeparator, CurrencyDecimals, DateSeparator, ShortDateFormat etc which are in the SysUtils unit. take a look on the help for more info.

2) You do not need to use first, last find in the loop just to insert new records, you need to use locate or find only to update the data for an existing record. So calling Append or insert will be enough but you always need to call post after you have finished editing a record/row.

3) There is no need to use the table in batch mode if you are not indead to send the new data in multiple rows to the server. If you just keep calling the update batch in the end of each record appended then just change the way the ADOTable is connected and returns data making use a server side cursor instead you will gain in speed.

After all this have been taken care and steel have problems inserting new rows to the server ask again.

Regards
Yannis.


.



Relevant Pages

  • Re: Creeping senility
    ... in order to reduce the amount of code in that unit, I want the code for the control of the stringgrid in another unit. ... In other words, I want the grid to be visible in one form, but the code for the grid in another unit. ...
    (borland.public.delphi.non-technical)
  • Re: Creeping senility
    ... However, in order to reduce the amount of code in that unit, I want the code for the control of the stringgrid in another unit. ... In other words, I want the grid to be visible in one form, but the code for the grid in another unit. ... I have not used frames before, but I'll look into that possibility. ...
    (borland.public.delphi.non-technical)
  • Re: Question about replacing a spreadsheet
    ... What about using a stringgrid such as the one from TMS ... dumping the results into the stringgrid. ... This grid does have disjunct cell selections for selecting those cells with ... You can even dump the resulting grid back into an Excel format. ...
    (borland.public.delphi.thirdpartytools.general)
  • A simple home-made StringGrid
    ... simple grid. ... operations are relevant to the StringGrid and some to the DataTable. ... namespace StringGridExmpl { ... a new DataRow Object. ...
    (microsoft.public.dotnet.languages.csharp)