错误无法将void分配给隐式类型的局部变量

我在sql server中具有存储过程以插入用户,但是在尝试使用我拥有的DTO类映射sp时遇到此错误。


DataClasses1DataContext _dataContext = new DataClasses1DataContext();


public List<WebUserDTO> InsertUser (string Username, string UserPassword, string FullName, string Email)

    {

        var user = _dataContext.WebUser_InsertUser(Username, UserPassword, FullName, Email);

        return user.Select(aux => new WebUserDTO()

        {

            UserName = aux.Username,

            UserPassword = aux.UserPassword,

            FullName = aux.FullName,

            Email = aux.Email

        }).ToList();

    }

错误在这里显示:var user = _dataContext.WebUser_InsertUser(Username, UserPassword, FullName, Email); 我的插入sps以下,并且dbo.WebUser_InsertUser在sql server中执行时我得到正确的结果


CREATE PROC dbo.WebUser_InsertUser0

    @Username AS NVARCHAR (20),

    @UserPassword AS NVARCHAR (20),

    @FullName AS NVARCHAR (50),

    @Email AS NVARCHAR (50),

    @IdUser AS INT OUT

AS

BEGIN

SET NOCOUNT ON;

INSERT INTO dbo.WebUser (UserName, UserPassword, FullName, Email)

VALUES (@UserName, @UserPassword, @FullName, @Email)

SET @IdUser = SCOPE_IDENTITY()

RETURN @IdUser;

END

GO


CREATE PROC dbo.WebUser_InsertUser

    @Username1 AS NVARCHAR (20),

    @UserPassword1 AS NVARCHAR (20),

    @FullName1 AS NVARCHAR (50),

    @Email1 AS NVARCHAR (50)

AS

BEGIN

SET NOCOUNT ON;

DECLARE

    @UserId1 AS INT

EXEC dbo.WebUser_InsertUser @UserName1, @UserPassword1, @FullName1, @Email1, @UserId1 OUT

SELECT W.IdUser, W.UserTypeId, W.Username, W.UserPassword, W.FullName, W.Email

FROM dbo.WebUser AS W

WHERE W.IdUser = @UserId1

RETURN;

END


青春有我
浏览 441回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP