How to display specific record from a Stored Procedure.
My View:
My Model:
public int ID { get; set; }
public int VacancyID { get; set; }
public int UserID { get; set; }
[NotMapped]
public string Name { get; set; }
[NotMapped]
public string Surname { get; set; }
[NotMapped]
public string Gender { get; set; }
My C# Code:
var loginId = HttpContext.Session.GetInt32("loginId");
User user = new User();
Documents documents = new Documents();
using (var cmd = new SqlCommand("sp_Users", conn))//Users
{
conn.Open();
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader userReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
SqlParameter usertId = cmd.Parameters.AddWithValue("@UserID", loginId);
while (userReader.Read())
{
}
userReader.Close();
conn.Close();
}
//This returns a View For Application of a Candidate
return View();

Thamsanqa NgcongwanePosted Oct 17, 2019, 3:32 AM
Nakul ChaudhariPosted Oct 17, 2019, 3:30 AM