SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 440 | Next

Scott Klein

"Professional LINQ"

SelectCommand.Parameters.AddWithValue("@ID", salesPersonID);
da.TableMappings.Add("Table", "SalesOrderHeader");
da.Fill(ds);
DataTable header = ds.Tables["SalesOrderHeader"];
textBox1.Text = ds.Tables[0].Rows.Count.ToString();
IEnumerable orderHeader =
from oh in header.AsEnumerable()
where oh.Field("OrderDate").Year == 2003
select oh;
DataTable dt = orderHeader.CopyToDataTable();
DataView dv = new DataView(dt);
dataGridView1.DataSource = dv;
}
280
Chapter 14: LINQ to DataSet
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
You could just have easily set the DataSource of the DataGridView to the DataTable, as follows:
dataGridView1.DataSource = dt;
However, the DataView provides capabilities such as sorting and filtering the data stored in a DataTable.
For example, you can filter the data by state of the row or via a filter expression.
You can also implicitly bind data to controls by implementing the IListSource interface. This interface
provides an object the ability to return a list that is bindable to a data source.


Pages:
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6