Editing a field in a DataRow
Hi.
When working on an application connected to a database I stumbled upon a question which I can't seem to find an answer for searching the Web.
Which of the following two ways are to prefer when editing fields in a DataRow, and why?
If it's of any concern I'm NOT using LINQ to retrieve the DataRow.
This:
Code:
DataRow dr = ...
string myValue = "...";
dr["myField"] = myValue;
myValue = (string)dr["myField"];
Or this:
Code:
DataRow dr = ...
string myValue = "...";
dr.SetField<string>("myField", myValue);
myValue = dr.Field<string>("myField");
Regards,
Michael