Neal Stublen How does XMLReader work?  XmlReader.Read() Advances to next node XmlReader properties access node name, value, attributes,

Slides:



Advertisements
Similar presentations
LINQ and Collections An introduction to LINQ and Collections.
Advertisements

Michael Pizzo Software Architect Data Programmability Microsoft Corporation.
Extension Methods, Anonymous Types LINQ Query Keywords, Lambda Expressions Svetlin Nakov Telerik Corporation
Current Popular IT I Pertemuan 6 Matakuliah: T0403/Current Popular IT I Tahun: 2008.
Concepts of Database Management Seventh Edition
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Introduction to Structured Query Language (SQL)
C# 3.0 Tom Roeder CS fa. Version 3 From PDC 2005 preview compiler available LINQ: language-integrated query High level points: adds native query.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
C# 3.0 and LINQ Pavel Yosifovich CTO, Hi-Tech College
Microsoft Access 2010 Chapter 7 Using SQL.
A tour of new features introducing LINQ. Agenda of LINQ Presentation We have features for every step of the way LINQ Fundamentals Anonymous Functions/Lambda.
® IBM Software Group © 2006 IBM Corporation The Eclipse Data Perspective and Database Explorer This section describes how to use the Eclipse Data Perspective,
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation MongoDB Read Lecturer.
® IBM Software Group © 2006 IBM Corporation JSF Tab Controls This Learning Module shows how to develop server-side EGL applications with dynamic content.
XML files (with LINQ). Introduction to LINQ ( Language Integrated Query ) C#’s new LINQ capabilities allow you to write query expressions that retrieve.
LINQ Programming in C# LINQ CSE Prof. Roger Crawfis.
PHP1-1 PHP & SQL Xingquan (Hill) Zhu
 Introduction  What is LINQ  Syntax  How to Query  Example Program.
Introduction –All information systems create, read, update and delete data. This data is stored in files and databases. Files are collections of similar.
Databases in Visual Studio. Database in VisualStudio An MS SQL database are built in Visual studio The Name can be something like ”(localdb)\Projects”
Microsoft Access DataBase Automated Grading System
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
Neal Stublen Populating a Database  SQLExpress should be installed with Visual Studio  The book provides a.sql file for populating.
Putting it all together: LINQ as an Example. The Problem: SQL in Code Programs often connect to database servers. Database servers only “speak” SQL. Programs.
Advanced C#, part IV Niels Hallenberg IT University of Copenhagen (With thanks to Peter Sestoft and Kasper Østerbye) BAAAP – Spring 2009.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Extension Methods, Anonymous Types LINQ Query Keywords, Lambda Expressions Based on material from Telerik Corporation.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Introduction to LINQ Lecture # 19 August Introduction How do you interrogate/manipulate data? What if you could do the work in a type-safe," string-free.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
Neal Stublen Tonight’s Agenda  Interfaces  Generics  Code Organization  Databases  ADO.NET  Datasets  Q&A.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
© Satyam Computer Services Ltd POC Architecture 1 Confidential – Limited Circulation.
Concepts of Database Management Seventh Edition
Optimization in XSLT and XQuery Michael Kay. 2 Challenges XSLT/XQuery are high-level declarative languages: performance depends on good optimization Performance.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
Class 2Intro to Databases Goals of this class Include & Require in PHP Generating Random Numbers in PHP Arrays – Numerically Indexed and Associative Program.
CS 1308 Computer Literacy and the Internet
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 3 Handling Data in PL/SQL Blocks.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
Java Basics.  To checkout, use: svn co scb07f12/UTORid  Before starting coding always use: svn update.
DT228/3 Web Development Databases. Querying a database: Partial info Search engines, on-line catalogues often need to allow user to search a database.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
PHP getting data from a MySQL database. Replacing XML as data source with MySQL Previously we obtained the data about the training session from an XML.
Oracle10g Developer: PL/SQL Programming1 Objectives SQL queries within PL/SQL Host or bind variables The %TYPE attribute Include queries and control structures.
Object Oriented Programming Generic Collections and LINQ Dr. Mike Spann
CSCI 3327 Visual Basic Chapter 8: Introduction to LINQ and Collections UTPA – Fall 2011.
Oracle Data Integrator User Functions, Variables and Advanced Mappings
Session 1 Module 1: Introduction to Data Integrity
Linq Overview Vincent GERMAIN. Evolution - Rappel Langage  C# 2.0  C# 3.0 (Local type inference, Lambda expression, Method extension,Anonymous type)
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises 1 Xiang Lian The University of Texas – Pan American Edinburg,
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
Change Display of a Key Figure While in the Change Query (Local Definition) Hiding 1.Right click.
LINQ to DATABASE-2.  Creating the BooksDataContext  The code combines data from the three tables in the Books database and displays the relationships.
SQL. Originally developed by IBM Standardized in 80’s by ANSI and ISO Language to access relational database and English-like non-procedural Predominant.
LINQ Language Integrated Query LINQ1. LINQ: Why and what? Problem Many data sources: Relational databases, XML, in-memory data structures, objects, etc.
Module 10: Data Access in ASP.NET. Overview Overview of the ASP.NET Data Access What is Data Access List of Data Source Control What is Data Bound How.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Chapter 11.  Large amounts of data are often stored in a database—an organized collection of data.  A database management system (DBMS) provides mechanisms.
Functional Programming Data Aggregation and Nested Queries Ivan Yonkov Technical Trainer Software University
Web Systems & Technologies
Chapter 12 Information Systems.
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections UTPA – Fall 2012 This set of slides is revised from lecture slides.
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises UTPA – Fall 2012 This set of slides is revised from lecture.
Presentation transcript:

Neal Stublen

How does XMLReader work?  XmlReader.Read() Advances to next node XmlReader properties access node name, value, attributes, etc. Returns false if there are no additional nodes

Reading XML Files XmlReader r = XmlReader.Create(path, settings); r.ReadToDescendant(nodeName); do { r.ReadStartElement(nodeName); r.ReadElementContentAsString(); } while (r.ReadToNextSibling(nodeName)); r.Close();

Code Practice  Create a new project called CustomerImport  Import Customers into a List<> from any.xml file  Fill a TreeView with the Customer data

Review  TreeView  XmlReader

var Data Type  We can declare a variable as type “var” instead of using a specific data type The compiler assigns an implicit data type at compile-time (not run-time) var value = 0; var array = new string[10]; var list = new List (); var str = "Hello"; // str is string type str = 6; // can’t assign int

What’s LINQ?  SQL-like query expression on any enumerable object type int[] numbers = new int[100]; for (int index = 0; index < 100; ++index) { numbers[index] = index; } var odds = from number in numbers where number % 2 != 0 select number;

Try it in LINQPad  Duplicate code from previous slide  Filter out prime numbers from array using LINQ query

LINQ Expressions from [type] element in collection join element2 in collection2 on key1 equals key2 where condition // any boolean expression orderby expression [ascending|descending] select columnExpression select new [type] { name=value, name=value }

LINQ Expressions from cust in customers join invoice in invoices on cust.CustomerID equals invoice.CustomerID where invoice.InvoiceDate < sixtyDaysAgo orderby invoice.InvoiceTotal descending select

Try it with CustomerImport  Create a List object by looping through SqlDataReader  Perform LINQ queries on List

LINQ-to-SQL  Create objects that represent database entities  Use the same LINQ query expressions against a database  Just restricts “where” clause to SQL- compatible operations

See It In Action

LINQ on Database Objects  Add LINQ data objects to a project  Drop tables from Server Explorer  Use the new DB to query the database using LINQ  Insert, Update, Delete objects, db.SubmitChanges()  Add related items, db.SubmitChanges()  Paging: (from…).Skip(5).Take(5)

LINQ’d Customer-Invoice List  Using LINQ objects, fill a list view with all invoices sorted by CustomerName

ToolTips and HelpProviders  Add ToolTip control  Set ToolTip property on each control and/or the form  Hover over control to show tool tip  Add HelpProvider control  Set the HelpString on each property and/or the form  Press F1 while the control has focus to show help string

Tab Control  Separate panels to group items  Tab across edge changes panel visibility