Monday, October 06, 2008

For Reference: Getting a Datatable Programmatically from a DataSource

I've used this before (that is, pulling a datatable directly from a datasource), but always forget how when I need to. So for reference.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=228386&SiteID=1

Just remember to update your datasource paramaters.


DataView view =
(DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
DataTable table = view.ToTable();
DataSet ds = new DataSet();
ds.Tables.Add(table);

No comments: