I have an empty column in SQL Table that I want to update.
List<UriDataModel> channelData = new List<UriDataModel>();
for (int i = 0; i < channelNames.Count(); i++)
{
channelData.Add(new UriDataModel()
{ SerialNumber = serialNumber[i],
ChannelType = channelUom[i],
Calculated = calculated[i]
});
};
I don't want to insert new records, I want to update the column in a row that has other data. There could be around 80,000 records per channel name.
The serial number is unique and will contain one or more channels. Such that serial number 321654, may have six channels, called channel1, channel2 etc. The calculated field is a bool
When I do this:
db.UriData.AddRange(channelData);
db.SaveChanges();
Obviously, this will just add a new record.
I need to find the record from the DB, by saying something like and updating the record.
UPDATE ChannelType, Calculated
WHERE SerialNumber ='987654'
AND ChannelName = 'channel1'
I'm thinking of just firing a SPROC, but I would like to understand how to do it in LINQ.