How to Extract data from a SQLDataSource to a datatable
Is it possible to store data that is retrieved by SqlDataSource in a DataTable? I mean, If I dragged and dropped a GridView and an SqlDataSource and then I set up those controls in page designer in Visual Studio, is it possible at some time later to retrieve the data retrieved by the SqlDataSource and then store the data in a DataTable?
2 Solutions collect form web for “How to Extract data from a SQLDataSource to a datatable”
Probably worth having a look at this:
DataTable out of SQLDataSource
As far as I can gather, what egoldin is doing is filling the gridview, then using the rowDataBound event, he/she is then taking this data returned and converting it to a table, which can be used at a later stage.
i got the answer from @Robbie
Protected Sub DossierGV_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles DossierGV.RowDataBound If (e.Row.RowType = DataControlRowType.DataRow) Then If Me.firstTime Then Dim dv As System.Data.DataView = CType(e.Row.DataItem, System.Data.DataRowView).DataView Me.dtDS = dv.ToTable Me.firstTime = False End If End If End Sub