Private Sub GetRowsByFilter()
Dim table As DataTable = DataSet1.Tables("Orders")
' Presuming the DataTable has a column named Date.
Dim expression As String
expression = "Date > #1/1/00#"
Dim foundRows() As DataRow
' Use the Select method to find all rows matching the filter.
foundRows = table.Select(expression)
Dim i As Integer
' Print column 0 of each returned row.
For i = 0 to foundRows.GetUpperBound(0)
Console.WriteLine(foundRows(i)(0))
Next i
End Sub
--------------------------------- OR ----------------------------------------
Protected Sub DDLCompany_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim ds As New DataSet
ds = ViewState("ViewDDLMaster")
' Filter Division as per Company
Dim tempDView As DataView
tempDView = ds.Tables(1).DefaultView
tempDView.RowFilter = "div_company ='" + DDLCompany.SelectedValue.Trim + "'"
'GridView1.DataSource = tempDView.ToTable()
'GridView1.DataBind()
DDLDivision.DataSource = tempDView.Table
DDLDivision.DataTextField = "div_desc"
DDLDivision.DataValueField = "div_code"
DDLDivision.DataBind()
DDLDivision.Items.Insert(0, "Select")
End Sub
No comments:
Post a Comment