Skip to content

Tag: c#

Override query in sql string possible? C#

Currently I’m working with my local MSSQL database and when I make a connection all works good. However that is not the question I’m having right now; I want to make my code cleaner and I don’t want to have duplicated code or almost duplicated code. For now I’m working with one large c…

Join multiple columns from the same table using Linq

I would like to convert following sql query into Linq to SQL going through this I have so far tried following which didn’t work out Edit: following query is being generated against Svyatoslav Danyliv answer which is returning 7 rows instead of 6 Answer Join which contains not just AND expressions is pos…

Is it possible to sum up time field in SQL Server?

I have 3 time(0) column in 1 row. I want to calculate arrival-Time column automatically and this is result of the sum of Departure-Time + Duration is it possible with trigger or computed area method? thanks in advance Answer SQL Server does not support direct addition on time values; however, you can use date…

Polly retry policy with sql holding transaction open

I am using Polly to implement a retry policy for transient SQL errors. The issue is I need to wrap my db calls up in a transaction (because if any one fails, I want to rollback). This was easy before I implemented retry from Polly because I would just catch the exception and rollback. However, I am now using …