How Can Convert DataRow to DataRowView in c#

Harry Sarshogh picture Harry Sarshogh · Mar 26, 2013 · Viewed 25.6k times · Source

Can or how to convert DataRow to DataRowView?

For example:

   DataTable dt=ds.Tables[0];
   DataRow dr= dt.NewRow();           
   DataRowView drv = ???? 

Answer

BizApps picture BizApps · Mar 26, 2013

Use

DataTable dt=ds.Tables[0];
DataRow dr= dt.NewRow();         
DataRowView drv= dt.DefaultView[dt.Rows.IndexOf(dr)];