Skip to content
Advertisement

Tag: c#

Update value if exist or insert in SQL with C# linq

I have this code which is working fine and I update a value if exists or insert if not With this code I manage to do the work with only one query to the SQL, but I was wondering if there is an easier or more elegant way to do it. For example if I could use linq and lambda

Select items with the same foreign key

I have a question regarding Linq in C#. Let’s say that I have 3 tables “Company”, “Employee” and “Job”. Company ——– Id – int (PK) Name – string Employee ——– Id – int (PK) CompanyId – int …

C# Error : Unable to insert record in SQL

Please pardon my knowledge on C# as I am very new to it,I am unable to insert a record in SQL and getting the below error while insert image to SQL. Error : Object reference not set to an instance …

Using LINQ to fill a boolean with true or false based off of condition

I am performing a linq query to grab some data from the DB. Here is my linq: The main 2 tables I am concerned with here are JobRequest and JobRequestParameters… JobRequest table has 13 records (but not all jobs have parameters). JobRequestParameters table only has 4 records. They are joined on by PkJobRequestId. JobRequestParameters has a pkJobParameterId IF and only

Advertisement