Skip to content

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 …