How to correctly filter a datatable (datatable.select)

Posted by Phil on Stack Overflow See other posts from Stack Overflow or by Phil
Published on 2010-06-17T08:54:28Z Indexed on 2010/06/17 9:03 UTC
Read the original article Hit count: 565

Dim dt As New DataTable
Dim da As New SqlDataAdapter(s, c)

        c.Open()
        If Not IsNothing(da) Then
            da.Fill(dt)
            dt.Select("GroupingID = 0")
        End If

        GridView1.DataSource = dt
        GridView1.DataBind()
        c.Close()

When I call da.fill I am inserting all records from my query. I was then hoping to filter them to display only those where the GroupingID is equal to 0. When I run the above code. I am presented with all the data, the filter did not work. Please can you tell me how to get this working correctly. Thanks.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about vb.net