1

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?

Best regards,

Yassine Edouiri

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Just as a tip, it may be easier if you were to Google search some of your problems, for this answer I searched: "get datatable from sqldatasource". In the future you would get your answer a lot faster instead of consulting Stack. Hope it helps!
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.