user1548103
user1548103

Reputation: 869

DataViewRowState in a datatable.select

Sorry for the simple question, but I'm new to messing with datasets and and things like DataViewRowState. I ran across a line of code that I wasn't really sure what was going on. The line of code is used in a function to save changes from a dataset to the database. Anyhow, in there I saw the following:

someDataTable.Select("", "", DataViewRowState.CurrentRows)

and after poking around online, I found it difficult to find a specific example of this to explain exactly what was being selected here. In particular, I was curious what the difference between that call and

someDataTable.Select();

might be.

So my question is- what is the difference in results between those two calls?

Upvotes: 1

Views: 2776

Answers (1)

Steve
Steve

Reputation: 216313

The Select() method without parameters is implemented with a call to Select("","",DataViewRowState.CurrentRows)

This is the output from Reflector

public DataRow[] Select()
{
    Bid.Trace("<ds.DataTable.Select|API> %d#\n", this.ObjectID);
    return new Select(this, "", "", DataViewRowState.CurrentRows).SelectRows();
}

So there is no difference. For the part of your question regarding 'what is selected here' then CurrentRows selects all the rows currently non with the state deleted in the underlying datatable. More info in the DataViewRowState enum page on MSDN

Upvotes: 2

Related Questions