我在SQL中有一个存储过程,当我运行这个存储过程时,我得到数字38,但当我尝试在C#中运行它时,我得到数字0x00000026
。
如何将其转换为“正常”数字?
存储过程:
ALTER PROCEDURE Registration
(@UserName nvarchar(50),
@Password nvarchar(9),
@FirstName nvarchar(50),
@LastName nvarchar(50),
@EmailAddress nvarchar(50),
@BDate date,
@IdentityNumber nvarchar(50),
@RoleID int)
AS
IF (SELECT COUNT(1) FROM Users WHERE UserName =@UserName) = 1
BEGIN
RETURN -1
END ELSE
BEGIN
INSERT INTO Users(UserName, Password, FirstName, LastName, Email, IdentityNumber, BirthDate, RoleID)
VALUES(@UserName, @Password, @FirstName, @LastName, @EmailAddress, @IdentityNumber, @BDate, @RoleID)
RETURN Cast(@@IDENTITY as INT)
END
和数据访问层代码:
User test1 = DB.Users.Where(u => u.UserName == "223321").ToList();
var test2 = from users in DB.Users
where users.UserName == "223321"
select new
{
users.UserName,
users.UserID
};