I am new to the entity framework and LINQ. Trying to learn it by example. I have an Entity called “Participant” as below: I am trying to use Group by and return the result as Task<IEnumerable<Participant>>. The Sql Query that I found the is : SELECT Count(Id) as #, Zip FROM [database].[dbo].[Participants] GROUP BY Zip Order By Zip The Code
Tag: c#
How can I best implement async into my WPF application?
I’m working on a WPF application that runs SQL queries and returns a data grid of the results when pressed. Currently, the structure of my methods as I try to figure out async is as follows: Depending on the query ran, my application can get for anywhere between 30 seconds to 20 minutes. I have a progressbar on my application
Trying to work out why my query is sluggish
So I have this query in C#, it takes about 3.6 seconds to complete. Here is both table designs Product review table: Review Table: I did have my where clause like so, but made no difference: I’m not sure why it’s slow, does anyone have advice to speed it up? Thanks More Info: Both tables have 6069 rows I have
Add new column programmatically to DataGridView (DataGridview Filled with DataTable)
I have binded a datagridview with access database table. I want to add a new custom column to DataGridView when the program loads. This column contains the auto incremented number “Serial Number” for the rows in the DataTable. The code is below, But When I run the program the Serial number Column is empty. This column have to show numbers
can not check whether a table exists or not in postgresql
I’m writing a C program that connects to a postgreql db.I’m trying to check for a table : this variable is a global variable. but when I compile the code this error occurs: Answer If this is a global variable, C requires that it be initialized with something known at compile time; if it requires a call to PQexec(), this
A problem with the foreign key using Entity-Framework
Im using Entity Framework and have this two classes: And I instance a new Product like this: When I add and save this object, does not record it in the database, but if I instance the product with a NULL value in the Client attribute, does appear but with that NULL value. I dont know why this is happening… Answer
Possible memory leak in simple batch file processing function in c#
I’m running a very simple function that reads lines from a text file in batches. Each line contains an sql query so the function grabs a specified number of queries, executes them against the SQL database, then grabs the next batch of queries until the entire file is read. The problem is that over time with very large files the
One large DB request plus many Casts vs. many single DB requests – which is faster for a lot of Data [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. Improve this question let’s say you have 5 concrete classes implementing the interface IResult. And you want to work with many diffrent concrete objects
Converting complex SQL with FULL JOIN to Linq
I am trying to convert a SQL statement to Linq/Entity Framework, and am having a difficult time. Below is the SQL. The FULL JOIN and the GROUP BY seem to be what I’m struggling most with. I’ve reviewed this SO answer and I understand how to execute a FULL JOIN on its own, but can’t figure out how to integrate
How to Select Records from large table batch wise in SQL
I have a table that contains billions of records. I want to select records in a batch using the c# while loop. I used Offset and Fetch Next, but it is taking too long to get results. If the table contains below 100k records, it works fine. What is the best way to batch select records? Sample Code Answer If