Atta Kumah

Atta Kumah

  • NA
  • 167
  • 11.5k

("SelectUserName @Name", new SqlParameter("@Name", Name))

Apr 2 2019 7:44 PM
Please i want to use below statement to get Particular User Details From Database to View without assigning String Name to a specific Name(I want to Enter, let say Kumar in a different Page and get the user Details in another Page). Please this is Homework and i am finding things difficult.
 
Please Humble appeal. Any answer is kindly welcome and honored
 
This is My Controller
 
public async Task<ActionResult> Index( )
{
using (var context = new UserDb())
{
string Name = " Kumar";
var Data = context.tbl_Employee.SqlQuery("SelectUserName @Name", new SqlParameter("@Name", Name)).ToList();
return View(Data);
}
}

Answers (5)