convert a dataview to a dataset dataview to datatable
public static DataTable DataViewAsDataTable( DataView dv)
{
DataTable dt = dv.Table.Clone();
foreach (DataRowView drv in dv)
dt.ImportRow(drv.Row);
return dt;
}
DataSet dsFiltered = new DataSet(); //create a new dataset
dsFiltered.Tables.Add(AppUtil.DataViewAsDataTable (dvResult) ); //fill the dataset with the sorted results
16 Comments:
Good, it is very helpful
Is iterating through the dataviewrows really the only way to do this?
I haven't found a better way to do it (after 15 minutes of searching) so I'm guessing there isn't one. But it seems a bit funny that you have to iterate through the datarows. Thanks anyway - this is the best solution I found so far.
Software Dorset
This is better me thinks..
ds.Tables.Add(dv.Table.Copy());
Thaks dude...i couldnt figure out a better one...
An easier way:
DataTable newOne = dv.ToTable();
Available in .NET 2.0 and above only.
Thank you, dorked around with this forever... was trying to avoid iteration, but apparently that is the only choice in 1.1
Thanks a lot mate...
this solution was exactly that i was looking for....Hat's OFF
awesome thank you. i guess there is no dv.toTable() in 1.1. 2.0 makes it easier.
Thanks friend. I tried multiple ways to create dataset from Dataview.. Yours is the best one..
You know ,I have some wonderland Gold,and my friend
also has some wonderland online Gold,do you kouw they
have the same meaning,Both of them can be called
wonderland money,I just want to
buy wonderland Gold,because there are many
cheap wonderland online Gold
Thanx dude Its working for me :D
This is exactly what I needed. Thank you so much!
Thanks! I was searching for same since long time!! Thanks for this solution !!
Thanks that really helped.
Awesome solution! Thanks mate...
thankuuuuuuuu very much.......
i m searching this for so many sites at last u finish my searching ,tanku.....
Post a Comment
<< Home