I have a table with multiple columns and I want to update only one column. I'm writing a method that first fetches the record and then updates it by changing the value of the column. Like this:
using (myDC...)
{
var recordInDB = (from...
where ....
select r).SingleOrDefault();
if (recordInDB != null)
{
recordInDB.MyColumn = newValue;
myDC.SubmitChanges();
}
Is this going to keep all the other columns as they were and only update the one I want to change or is this going to clear all columns and update the column MyColumn with the new value?
This will not change the other columns in your table. Only the one you are updating.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With