ASP - Stored Procedure 로 참,거짓 반환하기


CREATE PROC spx_ shimpark
    @subject varchar(50),
    @category varchar(50),
    @file_name varchar(50),
    @error_flag int output
As
Begin
   INSERT shimpark(a, b, c, d)
   VALUES (@subject, @category, GETDATE(), @file_name)

   SET @error_flag == @@error
End

With cmd
    .ActiveConnection = con
    .CommandType = adCmdStoredProc
    .CommandText = "spx_ shimpark"
    .Parameters.Append .CreateParameter("@subject", adVarChar, adParamInput, 50)
    .Parameters.Append .CreateParameter("@category", adVarChar, adParamInput, 50)
    .Parameters.Append .CreateParameter("@file_name", adVarChar, adParamInput, 50)
    .Parameters.Append .CreateParameter("@error_flag", adInteger, adParamOutput, 0)
    .Parameters("@subject") = subject
    .Parameters("@category") = category
    .Parameters("@file_name") = filename
    .Parameters("@error_flag") = 0
    .Execute ,,adExecuteNoRecords
    error_flag = .Parameters("@error_flag")
End With

if Cint(error_flag) = 0 then
     참이다.
else
     거짓이다
end if
TAGS.

Comments 0