Я получаю сообщение об ошибке при выполнении процедуры ниже хранилища из кода c #
ALTER Proc [COMMON].[SSP_loginAuthCheck]
@Emp_Id as Varchar(25),
@Emp_Pwd as Varchar(50),
@ClientHostName as Varchar(100),
@LogIn_Status as Varchar(50) out as
Begin
BEGIN TRY
SET NOCOUNT ON
If Exists (Select 1 From COMMON.LoginUserMaster with(nolock) Where EmpID = @EMP_Id and [Password] = @Emp_Pwd and IsActive = 1)
--If Exists (Select 1 From COMMON.LoginUserMaster Where EmpID = @EMP_Id and IsActive = 1)
Begin
if(isnull(
(
select top 1 q.SubQueueName from OPS.Productivity p with(nolock)
inner join COMMON.SubQueueMaster q with(nolock) ON p.SubQueueID=q.SubQueueID
where EmpID = @Emp_Id and ActivityDate = convert(date,GetUtcDate())
order by ProductivityID desc
)
,'') <> 'Login'
)
BEGIN
if((Select count(*) as logincount from ops.productivity (nolock) where EmpID=@Emp_Id And ActivityDate=convert(date,GetUtcDate()))=0)
BEGIN
Insert into OPS.Productivity([EmpID],[ActivityDate],[ActivityStartTime],[ActivityEndTime],[SubQueueID],HostName)
values(@Emp_Id,GetUtcDate(),GetUtcDate(),GetUtcDate(),(select top 1 SubQueueID from COMMON.SubQueueMaster where SubQueueName = 'Login'),@ClientHostName)
------------------------check if agent had started break and forgot to end it---------------------
IF exists(select 1 from (select ROW_NUMBER() over (partition by empid order by productivityid desc) numb,p.*
from ops.Productivity p with(nolock) join COMMON.SubQueueMaster s with(nolock) on p.SubQueueID=s.SubQueueID
where EmpID=@Emp_Id and ActivityDate <> CONVERT(date,getutcdate()) and isnull(s.QueueCode,'')<>'P01')t where numb=1 and ISNULL(ActivityEndTime,'')='')
BEGIN
IF exists(select 1 from COMMON.AgentStatus with(nolock) where EmpId=@Emp_Id and Status='Away')
BEGIN
update COMMON.AgentStatus set Status='Offline' where EmpID=@Emp_Id
END
END
------------------------check if agent had started break and forgot to end it---------------------
END
--insert status : only first entry of the day.....................-----------------------------------------
IF not Exists(Select 1 From COMMON.AgentStatus with(nolock) Where EmpId = @Emp_Id and Status='Away')
BEGIN
If Exists (Select 1 From COMMON.AgentStatus with(nolock) Where EmpId = @Emp_Id And ActivityDate<=convert(date,GetUtcDate()))
Begin
Delete From COMMON.AgentStatus where EmpId = @Emp_Id
Insert into [COMMON].[AgentStatus]([EmpId],[ActivityDate],[Status]) values(@Emp_Id,GetUtcDate(),'Online')--Insert status
END
Else
Begin
Insert into [COMMON].[AgentStatus] ([EmpId],[ActivityDate],[Status]) values(@Emp_Id,GetUtcDate(),'Online')
END
END
END -- update status
Update [COMMON].[AgentStatus] set [Status]='Online' where EmpId = @Emp_Id And [Status] = 'Offline';
Set @LogIn_Status = 'SUCCESS'
delete from AUTH.Token where EmpID = @Emp_Id;
insert into AUTH.Token(EmpID,TokenKey,ValidityDate) values(@Emp_Id,NewID(),getUtcDate());
END
Else
Begin
Set @LogIn_Status = 'FAILED'
End
END TRY
BEGIN CATCH
SELECT
ERROR_MESSAGE() ErrorMessage;
END CATCH
End
выше хранимого процесса вызывается ниже из кода c #
using (var contex = new Darwin_SalesMaxEntities())
{
contex.SSP_loginAuthCheck(userName, password, hostName, logStatus).FirstOrDefault();
var result = logStatus.Value.ToString();
}
ранее при обновлении модели объекта, этовозвращаемый процедурой тип был int, но теперь он становится строкой ObjectResult
Теперь при выполнении этого я получаю сообщение об ошибке «Средство чтения данных, возвращенное поставщиком данных хранилища, не имеет достаточного количества столбцов для запрошенного запроса»