linq

  1. xtian

    Why does restclient.executeasync<list<T>>() return null for an array-valued JSON response?

    I need help with the project I am currently working on. Please bare with me, I'm not good at coding specially with c# this is my first attempt. I have a button the will pull the data from webservice. Saving of data to database will be triggered with the same button. I have manage to display the...
  2. B

    DataTable select with delimiter

    Hi, is it possible to do a row filter or linq where splitting the filter string by commas Name Department User 1 HR User 2 PR User 3 IT User 4 Sales i would like to pass in a search string, eg: HR,PR, user 1 and user 2 should come out
  3. S

    Get parent data by querying child data

    I have two models Public Class Orders { public int id{ get; set; } public string OrderNumber{ get; set; } public Int Status{ get; set; } public datetime OrderDate{ get; set; } public List<LineItem> LineItems { get; set; } } Public Class LineItem { public int Id { get...
  4. sachin Shrestha

    is it ok to call the same Linq query multiple times for loading object from DB in same action method

    Below is My Controller action in the first line I have gotten the student from db and in 5 line I have use service function in which I have passed the student id which will again load the student from db is it good public ActionResult DeleteStudentInterest(int studentId, String...
  5. Celso Miranda

    Question Order By List Duplicates Keys

    I have the following list IList studentTeste = new List() { new Student() { Id = 1, StudentId = 1, StudentName = "John"} , new Student() { Id = 2, StudentId = 1, StudentName = "John"} , new Student() { Id = 3, StudentId = 2, StudentName = "Ram"} , new Student() { Id = 4...
  6. Gcobani54

    Joining three entities using linq

    Hi Team I need some help in joining three entities using linq, i have one join but the problem i have i am getting a repetion of years, weekNum and day colums with data being incorrect. public IList<ExtractionViewModel> GetExtractionViewModels(string year, int week) {...
  7. S

    Query to find a single object from a single row

    Hi, I have problems to find the correct syntax to get a single result of a single row. I get the row (categories) and I can see in this row there is a CategoryIsObsolete field (it is that value I want) But when making af FirstOrDefault query the Category result is null - and I do not know why...
  8. G

    Search IIS SMTP log file for distinct "from" address' and count

    Hi, I am trying to create a program to read through IIS logs and count the unique "FROM" address, and count how many emails that address has sent. I have done a horrible version of it, based on knowing the emails in the file already, but I am trying to polish this up now but getting reading the...
  9. A

    Question Develop a Linq query

    Hello, I have a database in Access with this architecture: and I need with Linq to calculate and return the total price of a candidate’s training knowing that only the candidate who has attended at least 5 trainings gets a 20% discount. how to get this result with linq?
  10. M

    LINQ Where one property equals x, return the value of another property

    I have a constructor for an object, which I'm trying to query against instantiations of using LINQ. Where one property has a given value, I need to return the value of another property My constructor is as below: public Job(string organisationType, string contractingOrganisationType, int...
  11. A

    Resolved Cannot implicitly convert type error

    I am trying to fetch certain database values and store them in a datatable. After that I am applying linq to group by all the data with account number. I am storing the final result in a list which is of the following class type - class ListItems { public string accountNumbers...
  12. P

    How to access values from 2 datatable as tabel1.tabel2.columnname in C#

    I have one test data model and one excel book which has multiple sheets! all the sheet is having the same unique key "Test1" and I have a function which fetches all the data from all sheets having that key name "Test1" Now after join - I get one table having all the column name and values But...
  13. H

    Question How to call stored procedure with linq connection string?

    My problem is I use linq with connection string instead of dbml file, so stored procedure don't show in intellisense. Is there any way to call stored procedure with linq connection string? Thanks you!
  14. S

    Question Is the MVC redundant?

    I've been trying to decipher how the MVC design pattern works. I have found tutorials that state all of the business logic goes into the Model and others that state all of the business logic goes into the Controller and the data access goes into the Model. I have also come across tutorials...
  15. S

    actually connect to a SQL Server

    I've been trying to figure out how I can use LINQ to query a SQL Server database using C# for 2 days now. I've been through about a dozen tutorials but they all seem to lack that key step where you actually connect to a SQL Server database. I've been working in .NET and SQL Server for over 15...
  16. DracoConstellation

    FYI Amusing C# [Properties, Collection initialization, LINQ, etc.]

    Hi everyone. To avoid long stories I'll get straight to the point... Being a programmer, I check third-party open-source projects. Over the time I have collected a number of interesting C# features that I would like to share with you. Properties and how they can be used As we all know, a...
  17. B

    Tip Introduction to LINQ Queries

    LINQ (Language Integrated Query) is a feature introduced in Visual Studio 2008 used for querying and updating data. It can be used with databases (LINQ to SqL, LINQ to Dataset, LINQ to Entities), XML (LINQ to Xml), and with Objects (LINQ to Objects). LINQ architecture in .NET: LINQ has a 3...
  18. O

    ERROR: An entity can only be attached as modified...

    Hi all, I hope you can help me. This is an issue I have been battling with for days now, and I am struggling to resolve it. My setup: I am using VS2015 Community Edition I am using LINQ to SQL .Net 4.5 I have read up quite a bit on this specific error, and it seems there are a couple ways to...
  19. A

    List of class objects - Filter class objects with same values using LINQ

    Hi, I am using a class object (clsDetails) to store the player details as shown below. I am trying to filter a list of Class objects with same values using LINQ. I want to get the list of Players who are successful in all the 5 attempts. I am trying to get the do it using LINQ but it does...
  20. A

    SQL Data to specified JSon Format

    LIST Time Status A 22:05 0 B 22:10 1 C 22:30 1 A 22:40 0 C 22:50 1 B 22:60 1 The above table needs to be converted to below JSON format [ { "name": "A", data: [ [22:05,0], [22:40,0] ] }, { "name": "B", data: [ [22:10,1]...
Top Bottom