bazzer747 25 Posted February 20, 2020 Hi I've just seen the above function which Firedac provides, and read the DocWiki about it and it would be very helpful in my project as I create new records. However, I'm having difficulty understanding quite how it works, or rather what it requires passed with it. The Docwiki provides an example of how to program with it: ShowMessage(VarToStr(ADConnection1.GetLastAutoGenValue('MyGen'))); My question is - what is 'MyGen' referring to? I'm using MS SQL and the info says the method returns the last autogenerated value in the session. In my table I have an autogenerated column called 'ID' (an integer). I've changed the above example to read: ShowMessage( VarToStr( dm.fdcMSLTest.GetLastAutoGenValue( 'ID' ))); assuming what it wants passed to it is the fieldname that is autogenerated. However, this gives an error when run 'Capability is not supported'. Any thoughts would be appreciated. Share this post Link to post
ergeka 5 Posted February 20, 2020 I am using it with an empty string with MARIADB/MySQL. Quote ConnectionProd.GetLastAutoGenValue(''); According to the documentation this should work for MSSQL too. 1 Share this post Link to post
bazzer747 25 Posted February 20, 2020 Works a treat, many thanks. Why can't the documentation be a little more helpful, especially as the guys who are looking this up won't know how to use it. Frustrated, but glad for this forum 🙂 Share this post Link to post
Dmitry Arefiev 101 Posted February 21, 2020 For SQL Server the AName parameter usage is not specified. 1 Share this post Link to post