I am wondering if there is any way to retrieve the value of the 'identity' field in a newly added record from VB while using an Insert SQL statement. Similar to the '@@Identity' property in MS SQL Server. Thanks and Good Luck!
What version of Pervasive are you using? Pervasive.SQL 2000i SP4 and Pervasive.SQL V8 both support @@IDENTITY. Also, are you using the ODBC driver or the OLEDB driver?
info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician
Actually the SP4 OLEDB provider has a bug that prevents @@IDENTITY from returning correctly. You can contact Pervasive for an updated driver. The ODBC driver should work however. Pervasive V8 doesn't have this problem.
info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician
I was able to get the @@Identity property to work with the ODBC provider. However only when I made a separate call to the database. Is there any way to include this in the SQL Insert statement so that only one call is made (like MS SQL Server)? In a multiuser environment it is possible for another user to enter a record between the two calls and then the @@Identity could return an incorrect value, even as it returns the latest created identity value. Thanks and Good Luck!
The only way to wrap it in one call would be in a stored procedure. Just out of curiosity, what's the MS SQL call that would return it in one call? You might submit it to Pervasive in case they want to add it. info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.