Hi is there a way to update multiple columns without assigning values from one object to another
product.Name = pro.Name;
If you have around 50 columns then it's quite annoying in Linq2Sql you can do something like this
public Product UpdateRecord(Product pro)
{
if (pro.ProductID > 0) //means you have id so go for update
{
// get the existing record in a different method
Product PreviousRecord = Original_ByID(pro.ProductID);
// Now time to change the existing record with new record passed in parameter
var dal = new DALEntityModel();
dal.Products.Attach(pro, PreviousRecord);
dal.SubmitChanges();
}
}
public static Inventory Original_ByID(Int32 proId)
{
var dal = new DALEntityModel ();
return (from p in dal.Products
where p.ProductId == proId
select p).Single();
}
Is there a way to do this on open access