我有我想要返回的 SQL:
CREATE PROCEDURE [Zinc].[GetUserByEmail]
@Email nvarchar (256)
AS
SELECT zu.UserId FROM zinc.users zu WHERE zu.Email = @Email
然后在我的存储库中我到目前为止:
public int GetUserByEmail(string email)
{
using (SqlConnection conn = new SqlConnection(ZincModelContainer.CONNECTIONSTRING))
{
using (SqlCommand cmd = conn.CreateCommand())
{
conn.Open();
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "[Zinc].[GetUserByEmail]";
//not sure how to go from here?
}
return userId;
}
}