

Kyle Miller
-
Content Count
29 -
Joined
-
Last visited
Posts posted by Kyle Miller
-
-
Given:
1. Database is MSSQL
2. TFDQuery & an TFDUpdateSQL assigned as the update object.
3. TFDUpdateSQL.InsertSql executes a stored procedure to perform insert, which affects a number of tables.
4. TFDUpdateSQL.InsertSql stored procedure returns an ID field value, which is the key field in TFDQuery. Ex: UserId.
5. UserId is an AutoInc TField in the TFDQuery.
What is the proper way to push the value returned by the stored procedure into the AutoInc field on an inserted record? Previous methods I used are not working.
Here is some code that does NOT work:
declare @SysUserId int; exec dbo.SysUserUpdate @SysUserID = @SysUserID output, @UserName = :UserName, @Password=:Password, @FullName = :FullName, @EmailAddress = :EmailAddress, @CompanyLocationId = :CompanyLocationId, @IsActive = :IsActive, @SysApplicationKey = :SysApplicationKey, @ModuleAccess1 = :ModuleAccess1, @ModuleAccess2 = :ModuleAccess2, @PolicyAccess1 = :PolicyAccess1, @PolicyAccess2 = :PolicyAccess2 select :SysUserId=@SysUserId
-
There is a Delphi Dev channel. But a channel which echos every post here? That would be noisy.
TFDUpdateSQL, Stored Procedure - Setting field value from output variable
in Databases
Posted
Thanks for the reply. I changed the Select as you have. No dice. The autoinc field still says -1 after InsertSql runs.
Any properties on the TFDAutoIncField or TFDQuery to check?