为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

C#
青春有我 2021-05-18 21:50:49
我在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 OUTASBEGINSET NOCOUNT ON;INSERT INTO dbo.WebUser (UserName, UserPassword, FullName, Email)VALUES (@UserName, @UserPassword, @FullName, @Email)SET @IdUser = SCOPE_IDENTITY()RETURN @IdUser;ENDGOCREATE PROC dbo.WebUser_InsertUser    @Username1 AS NVARCHAR (20),    @UserPassword1 AS NVARCHAR (20),    @FullName1 AS NVARCHAR (50),    @Email1 AS NVARCHAR (50)ASBEGINSET NOCOUNT ON;DECLARE    @UserId1 AS INTEXEC dbo.WebUser_InsertUser @UserName1, @UserPassword1, @FullName1, @Email1, @UserId1 OUTSELECT W.IdUser, W.UserTypeId, W.Username, W.UserPassword, W.FullName, W.EmailFROM dbo.WebUser AS WWHERE W.IdUser = @UserId1RETURN;END
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 440 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信