开发者

Search data from dataset

开发者 https://www.devze.com 2023-03-29 13:41 出处:网络
I want to search record based on following fields P_num ,P_name, P_dob,P_code I am using more than 4 tables to retrive data,

I want to search record based on following fields

    P_num ,P_name, P_dob,P_code

I am using more than 4 tables to retrive data, I have created dataset called P_search and i want to fill开发者_开发百科 data into dataset and thsn display it according to which field is selected for search purpose.

Suggest me to write code by creating own function in which all fields and a boolean variable will be taken as parameters

Please help me to write code using VB.net.

I am very new to VB.net. Is ther anyone who can help me giving above code.

Thank You In advance


You use DataTable.Select Method

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
0

精彩评论

暂无评论...
验证码 换一张
取 消