here is the code in Delphi2010 (TlLowStoredProc is successor of TMSStoredProc, AUID is OleVariant):
Code: Select all
LStored := TlLowStoredProc.Create(nil);
try
try
with LStored do
begin
StoredProcName := sSP_LoginUser;
Connection := AConnection;
PrepareSQL;
ParamByName(sSP_ALogin).Value := ALogin;
ParamByName(sSP_APass).Value := APass;
ParamByName(sSP_AUID).Value := Null;
ExecProc;
AUID := ParamByName(sSP_AUID).Value;
Result := ParamByName(AConnection.ReturnField).Value;
end;
except
end;
finally
LStored.Free;
end
Code: Select all
CREATE PROCEDURE DSP_LoginUser
@ALogin nvarchar(50),
@APass nvarchar(50),
@AUID uniqueidentifier OUTPUT
AS
SET NOCOUNT ON
SET @AUID = NULL
SELECT @AUID = User.UID
FROM dbo.User
WHERE User.LOGIN = @ALogin AND User.PASS= @APass AND User.DELETED = 0
RETURN (@@ERROR)