Re: Copying from grid to Adotable
- From: yannis <none@xxxxxxxxxx>
- Date: Thu, 18 Oct 2007 12:55:53 +0300
Thomas Willms explained on 18/10/2007 :
Hello,[Snip...]
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).
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.
.
- References:
- Copying from grid to Adotable
- From: Thomas Willms
- Copying from grid to Adotable
- Prev by Date: Copying from grid to Adotable
- Next by Date: TADODataSet AddNew syntax
- Previous by thread: Copying from grid to Adotable
- Next by thread: TADODataSet AddNew syntax
- Index(es):
Relevant Pages
|