Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
How can i select specific records from database in asp MVC?
Amit Kumar
7y
177
1
Reply
In the following code, I want to retrieve all those records whose Q_ID equals to the ID.
Currently, I Select whole records instead of few.
Please help me to solve this problem.
public
ActionResult Solution(
int
ID)
{
Answers ans_obj =
new
Answers();
List<Ans_Table> dbobj= db.Ans_Table.ToList();
List<Answers> ansobj = dbobj.Select(x =>
new
Answers
{
Answer = x.Answer,
Q_ID=x.Q_ID,
U_ID=x.U_ID
}).ToList();
return
View();
}
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
how to filter items from a selected dropdown list
How to bind pages without reloading the menus in layout page