Using Primary Keys in Dataset's DataTable

Hi,

I have a dataset that has one table and 5 columns in it and I have set 2 columns in the dataset table as primary key Columns. Now, how can I make use of these primary key columns

For eg: If I want to say that get me all rows where PrimaryKeyColumn1 = '11' and primaryKeyColumn2 = '44' then how would I say that

Would I have to use DataTable.Select method

Dataset.Datable(0).Select ("PrimaryKeyColumn1 = 11 and primaryKeyColumn2 = 44)


If so, then whats the benefit of adding primary key columns I can still use the select statement as it is by specifying the same column names without adding the columns as primarykey columns in the dataset.

Thanks



Answer this question

Using Primary Keys in Dataset's DataTable

  • Bill Tice

    I would just use the RowFilter property of the Dataview object.

    Dim dv as DataView
    dv = Dataset.DefaultView
    dv.RowFilter = "Column1Name=11 and Column2Name=44"

    HTH,
    Greg

  • Using Primary Keys in Dataset's DataTable