Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
- Posts: 104
- Joined: Sat 18 Aug 2012 08:33
I want to insert a new row into a table with an autoincrement field and want to know the autoincrement value after row inserted.
usually I use TMSSQL but I want a feedback so I think Ihave to use TMSQuery instead with following example syntax:
Code: Select all
INSERT INTO Table (fieldA)
The statement works fine, but I get -1 as RowsAffected, but should be 1?
Is this a bug or a mistake on my side?
- Devart Team
- Posts: 1058
- Joined: Fri 11 Apr 2014 11:47
- Location: Alpha Centauri A
We have investigated the behavior you described. The reason is that after execution of the INSERT INTO ... OUTPUT SQL query SQL Server returns us Rowset, but doesn't return the value of RowsAffected, and we can't affect this.