[[学校工作]
我有一个存储过程:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [IO].[usp_selectUser] (@username varchar(50))
AS
BEGIN
SELECT passwordSalt, hashedPassword
FROM [IO].[Users]
WHERE username = @username;
END
并且在我的C#程序中,我需要获取用户名匹配的passwordSalt
和hashedPassword
:
当前C#代码:
SqlCommand command = new SqlCommand("[IO].[usp_selectUser]", con);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@username", SqlDbType.VarChar)).Value = username;
我已经尝试过Google搜索结果中的一些内容,但是都无法正常工作。如何获得两个单独的字符串?
USE [TICKETING_DB]
GO
/****** Object: StoredProcedure [IO].[usp_selectUser] Script Date: 5/4/2020 11:08:10 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [IO].[usp_selectUser] (@username varchar(50), @passwordSalt varchar(50) output, @hashedPassword varchar(100) output)
AS
BEGIN
SELECT @passwordSalt = passwordSalt, @hashedPassword = hashedPassword FROM [IO].[Users]
WHERE username = @username;
END