Hi
I am trying below query. I want only those books from t2 which have BookRpl = 4 and does not exists in View_SessionBookPlanningRecommendations for students (1,17,18)
LMSDBDataContext context = new LMSDBDataContext();
var objResult = (from t in context.View_SessionBookPlanningRecommendations
from t2 in context.View_BookDetails
from t3 in context.StudentDetails
where (int)t.BookID == (int)t2.ID
&& t2.BookRPL == "4"
&& t.BookID != 65
orderby t.Name
select new
{
t.GroupName,
t.SessionDate,
t.BookTitle,
t.MentorName,
t.Name
}).ToList();
Thanks
Ramco RamcoPosted Apr 26, 2023, 12:06 PM
Hi
It is giving error - cannot convert from int? to string
Thanks
Naimish MakwanaPosted Apr 26, 2023, 11:51 AM
Use this
Ramco RamcoPosted Apr 26, 2023, 11:45 AM
Hi Naimish
How i can use studentcollectionlist in Linq Query
Thanks
Naimish MakwanaPosted Apr 26, 2023, 11:16 AM
Try below:
In this modified query, we first declare a collection of student IDs (in this case, an array of integers). Then we use the
Containsmethod with thestudentIdscollection to check if the book has a recommendation for any of the specified students. Note that thestudentIdscollection can be populated dynamically based on user input or other requirements.Thanks
Ramco RamcoPosted Apr 26, 2023, 11:13 AM
Hi Naimish
Student Id will be dynamic.
Thanks
Naimish MakwanaPosted Apr 26, 2023, 11:07 AM
Try below query:
Thanks