25 Feb 2012

select on datatable

gvItinerary.DataSource = Getdt(YourDataTable, "field ='0'")
gvItinerary.DataBind()

Protected Function Getdt(ByVal dt As DataTable, ByVal qry As String) As DataTable
        Dim dt1 As DataTable = dt.Clone()
        Dim dr() As DataRow = dt.Select(qry)
        For Each item As DataRow In dr
            dt1.Rows.Add(item.ItemArray)
        Next
        Return dt
End Function

No comments:

Post a Comment