I currently am using existing code that has
Sql.Append("UPDATE Store SET" +
"LogoAlign='" + (String.Compare(drpLogoAlign.SelectedValue, String.Empty) == 0 ? "NULL" : "'" + drpLogoAlign.SelectedValue + "'") +
"', Height='" + DB.QuerySafeDisplayHTML(txtHeight.Text.ToString()) +
"', Width='" + DB.QuerySafeDisplayHTML(txtWidth.Text.ToString()) +
and it goes on like that for all the columns in the table that it is updating. I would like to know if it would be better using LINQ, easier, more beneficial, and if so how would I go about doing it?
Thanks
For Linq To Entity you can just get all the
Storethan loop through them to change the value and use the Entity toSaveChanges.For example:
You can do the same with Linq To Sql with the DataContext.
But, if you want to be more performance, I think it should be in a stored procedure, this way you won’t need to get all the data before updating.