You are writing a method to do the following:

* Add a new row to a DataTable
* Set the second column, a column named LastName, to a string named lastName

Which code segment should you choose?

 Posted by Rajkatie on 9/30/2012 | Category: ADO.NET Interview questions | Views: 1350 | Points: 40
Select from following answers:
  1. dt.Rows[dt.Rows.Count]["LastName"] = lastName;
  2. dt.Rows.Add(lastName);
  3. DataRow dr = dt.NewRow(); dr["LastName"] = lastName; dt.Rows.Add(dr);
  4. All Above

Show Correct Answer

Source: MeasureUp.Com | | Alert Moderator 

Comments or Responses

Login to post response