Why DataTable.NewRow() RRS feed

  • Question


    Hello Guys,


    We use DataTable.NewRow() to create new row as NewRow will create row with known column structure for row.


    Can anybody tell any other specific reason? Why exactly other scenario won't work?


    Other scenario means..creating DataRow object and adding it to table.


    Thanks in advance.

    • Edited by AshokTeli Thursday, March 5, 2009 9:22 AM
    Thursday, June 26, 2008 7:09 AM

All replies

  • It is probably done this way to make sure that created new row 100% conforms to schema definition of created DataTable. Why are you asking this, do you have any specific concerns?


    Friday, June 27, 2008 10:11 AM
  • Hello,


    I have to add 100 rows using the following code. But my issue is that my last row gets overwritten.Please help.

    DataRow drHeaderW = dtHeaderQuanta.NewRow();

    drHeaderW["Order_No"] = dtProcessFileHeader.Rows[intHdr]["Order_No"].ToString();

    drHeaderW["Order_Suffix"] = dtProcessFileHeader.Rows[intHdr]["Order_Suffix"].ToString();

    drHeaderW["Type"] = "W";





    Wednesday, July 16, 2008 11:20 PM
  • How do you check that it is overwritten?


    Thursday, July 17, 2008 9:40 AM