hello sir ,
i am new beginner in Ef .can u write query syntax for us in .net ? how to limit no of records in ef
var commennt1 = (from b in ctx.Blogstatus
join c in ctx.CommentTables on b.id equals c.id_blog
select new
{
CommentMsg = c.CommentMsg,
CreatedBy = c.CreatedBy,
id = b.id
}).ToList().Select(y => new CommentTable
{
CommentMsg = y.CommentMsg,
CreatedBy = y.CreatedBy,
}
).ToList();
ViewBag.totalcomment3s = commennt1;
Madan ShekarRank #428 · 5.9K reputationPosted Jan 29, 2019, 11:23 PM EST
In view level
@model List
foreach(var i in Model)
{
@i.CommentMsg
Sanwar RanwaRank #23 · 44.7K reputationPosted Jan 29, 2019, 9:35 PM EST
Madan ShekarRank #428 · 5.9K reputationPosted Jan 29, 2019, 9:56 PM EST
// from db itself it wil take only 10 rows
any issues ping me
sonal malhotraRank #4,317 · 351 reputationPosted Jan 29, 2019, 10:05 PM EST
Madan ShekarRank #428 · 5.9K reputationPosted Jan 29, 2019, 10:23 PM EST
this will works pls check and let me know
sonal malhotraRank #4,317 · 351 reputationPosted Jan 29, 2019, 10:35 PM EST
Puneet KankarRank #446 · 5.6K reputationPosted Jan 29, 2019, 10:36 PM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts