CREATE PROCEDURE [dbo].[dmlEmployee_Insert]
(
@UserName char(10) ,
@HireDate datetime ,
@Age int ,
@UserID int output
)
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO Employee (UserName , HireDate , Age)
VALUES(@UserName , @HireDate , @Age)
SET @UserID = SCOPE_IDENTITY()
END
GO
Insert Command 內宣告參數 (@lcUserID、名稱可以自訂) 來接就行在 VFP 中顯示 identity 值
lcUserID = ""
lbResult = TABLEUPDATE(1,.T.,"Employee")
IF lbResult = .F.
AERROR(laError)
MESSAGEBOX(laError(2))
ELSE
MESSAGEBOX(lcUserID)
ENDIF
沒有留言:
張貼留言