Introduction to LINQ (2): Language-Integrated Query
Introduction to LINQ (2):
!
Language-Integrated Query
We have seen: LINQ to OBJECTS
!
now:
!
LINQ to DataSets
DataSets
Libraries:! System.Data.DLL! System.Data.DataSetExtensions.DLL! Namespaces:! System.Linq! System.Data
DataColumn
DataRow UniqueConstraint ForeignKeyConstraint
The DataSet can be seen as a collection of data residing in memory and organized in a relational way.
Creation of a DataTable
//Create the table! DataTable DT = new DataTable("DT_Name");! ! //Create the columns (fields)! DT.Columns.Add("Name",typeof(String));! DT.Columns.Add("Year",typeof(Int16));! ... ...! ! //Add data! DT.Rows.Add("John",1977);! DT.Rows.Add("Jack",1983);! ... ...! ! //Create a DataSet! DataSet myData = new DataSet("DS_Name");! myData.Tables.Add(DT);
LINQ Query on DataSets
with reference to the example in the previous slide:
//Query (. notation + lambda expression in this case)! var data = myData.Tables["DT_Name"].Rows.Cast()!
! ! ! .Where(ThisEntry => ! ! ! ! ! ! ! ThisEntry.ItemArray[0].ToString()=="John");! ! //Display the results:! foreach (DataRow row in data){ ! ! ...! }
Exercise: rewrite the query in the other LINQ style (from-where-select)
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- select specific columns from datatable in uipath
- c datatable select distinct where clause
- find text position uipath reverts
- column does not belong to table uipath
- schemas uipath workflow activities
- uipath read pdf with ocr activity will throw an error
- c compare datatable schema
- uipath activities guide pdf
- introduction to linq 2 language integrated query
- c declare new datatable
Related searches
- introduction to financial management pdf
- introduction to finance
- introduction to philosophy textbook
- introduction to philosophy pdf download
- introduction to philosophy ebook
- introduction to marketing student notes
- introduction to marketing notes
- grade 2 language test
- exam 2 introduction to sociology
- how to cite introduction to sociology 2e
- introduction to english language pdf
- introduction to language and linguistics