linq

  1. henryvuong

    Update a datatable from another datatable with LINQ

    In my C# code I have two datatable like this: inventory_table SKU Title Price Quantity Handling-Time SAM-GAL-S7-32 Samsung Galaxy S7 128GB 300.00 5 SAM-GAL-S6-64 Samsung Galaxy S6 64GB 250.00 10 SAM-GAL-NOTE-S20-128 Samsung Galaxy Note S20 128GB 275.00 7 IP-13P-128 Apple...
  2. ahmedaziz

    Question How to write c# function convert text input to sql server statement return string ?

    I work on some ui web tool on asp.net core blazor i need to write csharp function convert this conditions to sql statement so when i filter two columns as databasename and remarks (databaseName == null ? "" : databaseName).ToLower().Contains("db_".ToLower()) and (remarks == null ? "" ...
  3. 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...
  4. 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
  5. 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...
  6. 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...
  7. 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...
  8. 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) {...
  9. 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...
  10. 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...
  11. 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?
  12. 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...
  13. 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...
  14. 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...
  15. 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!
  16. 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...
  17. 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...
  18. 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...
  19. 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...
  20. 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...
Back
Top Bottom