Hi there,
I'm back to programming software to pc using D2009 and mysql. I started using MyDAC to access the data base. It is good, but isn’t free. So I kept looking for and I found the Zeos. I installed and made a simple example, the next step was get the value of ID auto increment field. I read some solutions using last_insert_id, but in my studies I found into event "AfterInsertSQLStament" on ZUpdateSQL a parameter "out UpdateAutoIncField: Boolean" and I put the parameter to true into procedure, after that the value of field ID already fill automatically.
So, as I found nothing about this method to get the autoincfield, I have a question about this. Is ok to use it to get the value of this kind of fields?
Get Auto Inc ID
Moderators: gto, cipto_kh, EgonHugeist
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi hsk,
I'm not a really experienced zeoslib user myself. I didn't use ZUpdateSql myself up to now. Do you need the component because your queries are too complex to be updated by the TZQuery directly?
If not, there's a really easy way to insert data an a TZQuery and fetch the autoincrement value with mysql. Just Append a row to the dataset, fill the non-autoincrement fields and when it's posted to the database, the autoincrement fields are automatically filled by the Last_insert_id.
If you do need ZUpdateSQL, somebody else will have to reply, I'm afraid.
Mark
I'm not a really experienced zeoslib user myself. I didn't use ZUpdateSql myself up to now. Do you need the component because your queries are too complex to be updated by the TZQuery directly?
If not, there's a really easy way to insert data an a TZQuery and fetch the autoincrement value with mysql. Just Append a row to the dataset, fill the non-autoincrement fields and when it's posted to the database, the autoincrement fields are automatically filled by the Last_insert_id.
If you do need ZUpdateSQL, somebody else will have to reply, I'm afraid.
Mark