Skip to content

Tag: .net

How to export data to already existing excel sheet in C#?

I know how to create a new excel and export data into it. But how can I export data to an already existing excel which have some formats and data validation? Answer Take a look to NuGet library ClosedXML . I used it in the past and it’s really straightforward. Install the package in your solution: from VS: Tools >

Write a SQL query with a subquery in .NET Core using Entity Framework that returns a list of items with varying number of returned child rows

I have this test SqlFiddle:!18/05fce/1 The idea is that for each product (table webspiderproduct) it will return the lowest price from each shopId from the table webspiderproductprice. So the returned data should look like this: I am using SQL Server. In pseudocode should I write a and then do a foreach through each row using linq and then add

Search SQL database with multiple filters

I have the following code: This gives me the rows where “category_id” is equal to the 1. I now want the SELECT statement to return rows where the “category_id” is equal to one of the values I give it. So a simple SELECT statement would look something like this The problem is that I wouldn’t know the values to search

How do I translate this specifik SQL statement to LINQ

SQL: C# Objects: Monitor: And Counter: And the objects that I need to turn it into is: AllStatistics: I don’t have much experience with LINQ so the most I’ve achieved with it is somethig like: My question is, how would I compose an LINQ statement with the same functionality of the above SQL query ? Answer It looks like you

Email address lookup in SQL Server

We have a large subscriber database and have a lookup based on email address of type nvarchar(100). It sometimes times out probably because of a large scan of it. I want to improve this, but weary of some of the options. Would an index on it be ok, I can handle the additional storage if needed, or a computed column

I’m getting the OleDb exception ‘Unspecified error the scale is Invalid’ when trying to use a stored procedure

I made a stored procedure in SQLExpress to insert information in both the Header and Details table. I’ve ran the stored procedure in SQL Server Management Studio to make sure it works fine. But when I try to use the stored procedure using TableAdapters in visual studio it gives me the error: System.Data.OleDb.OleDbException: ‘Unspecified error The scale is invalid.’ Here

Is is possible to create a view based on a table in a different server?

My client have an azure service app MyServiceApp, its database called MyCloudServer (its data is taken from a legacy MyPremiseServer). The MyPremiseServer is a server located on my client’s site, because the cloud’s service app MyServiceApp can’t access it, They created the MyCloudServer with the exact same scheme of MyPremiseServer. In order to make the MyCloudServer to hold the same