Chapter 15: Using LINQ to Access Data in C# Programs.

Slides:



Advertisements
Similar presentations
Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
Advertisements

Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
 Open the Paradise.exe file  Application displays records in the Books database  Allows the store manager to enter an author’s name (or part of a name)
Access Lesson 2 Creating a Database
Exploring Microsoft Access 2003 Chapter 1 Introduction to Microsoft Access: What Is A Database?
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
FIRST COURSE Microsoft Access (Basics). XP Objectives Define the terms field, record, table, relational database, primary key, and foreign key. Learn.
Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Concepts of Database Management Sixth Edition
Mgt 20600: IT Management & Applications Databases Tuesday April 4, 2006.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Management Information Systems MS Access 2003 By: Mr. Imdadullah Lecturer, Department of M.I.S. College of Business Administration, KSU.
Chapter Extension 6 Using Microsoft Access © 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke.
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ 1 Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Microsoft Access Database software. What is a database? … a database is an organized collection of data. A collection of data of similar information compiled.
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Unit J: Creating a Database Microsoft Office Illustrated Fundamentals.
Databases and LINQ Visual Basic 2010 How to Program 1.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
6-1 DATABASE FUNDAMENTALS Information is everywhere in an organization Information is stored in databases –Database – maintains information about various.
ASP.NET Programming with C# and SQL Server First Edition
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
DAY 14: ACCESS CHAPTER 1 Tazin Afrin October 03,
STORING ORGANIZATIONAL INFORMATION— DATABASES CIS 429—Chapter 7.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
Copyright © 2001 by Wiley. All rights reserved. Chapter 9: Introduction to Working with Databases in Visual Basic Database Concepts Relational Database.
1 Working with MS SQL Server Textbook Chapter 14.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
Access 2013 Microsoft Access 2013 is a database application that is ideal for gathering and understanding data that’s been collected on just about anything.
Microsoft Access You will need a pen/pencil.. What is Microsoft Access? Access is a database management system.  Create a database, add/change delete.
Discovering Computers Fundamentals Fifth Edition Chapter 9 Database Management.
Concepts of Database Management Seventh Edition
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
® Microsoft Office 2013 Access Creating a Database.
DAY 14: MICROSOFT ACCESS – CHAPTER 1 Madhuri Siddula October 1, 2015.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
Chapter 16: Using Relational Databases Programming Logic and Design, Third Edition Comprehensive.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
Database Management Supplement 1. 2 I. The Hierarchy of Data Database File (Entity, Table) Record (info for a specific entity, Row) Field (Attribute,
Chapter 24 I’m Suffering from Information Overload (Access Databases) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Chapter 9 Vocabulary Databases. 1.Table – a collection of information, or data arranged in columns and rows. 2.Record – all of the information about one.
Chapter 13.3: Databases Invitation to Computer Science, Java Version, Second Edition.
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
Chapter 9 Working with Databases. Copyright © 2011 Pearson Addison-Wesley Introduction In this chapter you will learn: – Basic database concepts – How.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
Microsoft Visual Basic 2010: Reloaded Fourth Edition
Visual Basic 2010 How to Program
Chapter 4 Relational Databases
Database Management  .
Databases and Information Management
Access Lesson 2 Creating a Database
Databases and Information Management
Microsoft Access Date.
Unit J: Creating a Database
Presentation transcript:

Chapter 15: Using LINQ to Access Data in C# Programs

2Microsoft Visual C# 2012, Fifth Edition Understanding Relational Database Fundamentals Database – Holds a file or, more frequently, a group of files that an organization needs to support its applications In a database, the files often are called tables because you can arrange their contents in rows and columns Primary key (or key) – A value that uniquely identifies a record

3Microsoft Visual C# 2012, Fifth Edition Understanding Relational Database Fundamentals (cont’d.)

4Microsoft Visual C# 2012, Fifth Edition Understanding Relational Database Fundamentals (cont’d.) Database management software – Also called a database management system (DBMS) – Allows you to: Create table descriptions Identify keys Add, delete, and update records within a table Arrange records within a table so they are sorted by different fields Write questions that select specific records from a table for viewing Write questions that combine information from multiple tables Create reports that allow users to easily interpret your data Keep data secure by employing sophisticated security measures

5Microsoft Visual C# 2012, Fifth Edition Understanding Relational Database Fundamentals (cont’d.) Database management software (cont’d.) – Establishes and maintains relationships between the columns in tables A group of database tables from which you can make these connections is a relational database

6Microsoft Visual C# 2012, Fifth Edition Creating Databases and Table Descriptions (cont’d.)

7Microsoft Visual C# 2012, Fifth Edition Identifying Primary Keys The primary key in a table is the column that makes each record different from all others – Each primary key must be unique Typical examples of primary keys include: – A student ID number in a table that contains college student information – A part number in a table that contains inventory items – A Social Security number in a table that contains employee information

8Microsoft Visual C# 2012, Fifth Edition Creating SQL Queries Query – Simply a request using syntax that the database software can understand Structured Query Language (or SQL) – The most common language that database administrators use to access data in their tables The basic form of the SQL command that retrieves selected records from a table – SELECT-FROM-WHERE Example: SELECT custId, lastName FROM tblCustomer WHERE state = "WI"

9Microsoft Visual C# 2012, Fifth Edition Creating an Access Database Microsoft Office Access – A relational database that is part of some versions of the Microsoft Office system

10Microsoft Visual C# 2012, Fifth Edition Creating an Access Database (cont’d.)

11Microsoft Visual C# 2012, Fifth Edition Creating an Access Database (cont’d.)

12Microsoft Visual C# 2012, Fifth Edition Understanding LINQ LINQ (Language INtegrated Query) Project – Provides queries that can be used in C# and Visual Basic In older versions of C#, you could access database data by passing an SQL string to a database object – OleDbCommand is a built-in type used to access databases LINQ provides a set of general-purpose standard operators that allow queries to be constructed using syntax that is easy to understand

13Microsoft Visual C# 2012, Fifth Edition Understanding LINQ (cont’d.) The operators defined in LINQ can be used to query arrays, enumerable classes, XML, relational databases, and other sources Some keywords in the LINQ vocabulary: – select indicates what to select – from indicates the collection or sequence from which data will be drawn – where indicates conditions for selecting records

14Microsoft Visual C# 2012, Fifth Edition Retrieving Data from an Access Database in C# Save time and reduce the chance for error by using the built-in tools of the Visual Studio IDE Tasks for adding a database table to a Windows Form project: – Drag a DataGridView object from the IDE’s Toolbox onto a Form Next, browse for the project data source and answer a few questions – Make a few choices and browse for the database file to add to the project

15Microsoft Visual C# 2012, Fifth Edition Retrieving Data from an Access Database in C# (cont’d.)

16Microsoft Visual C# 2012, Fifth Edition Retrieving Data from an Access Database in C# (cont’d.)

17Microsoft Visual C# 2012, Fifth Edition Retrieving Data from an Access Database in C# (cont’d.)

18Microsoft Visual C# 2012, Fifth Edition Retrieving Data from an Access Database in C# (cont’d.)

19Microsoft Visual C# 2012, Fifth Edition Using LINQ Queries with an Access Database Table You are not required to use the data grid to view database records You can use a LINQ query to select a collection of data from a table when specific criteria are met

20Microsoft Visual C# 2012, Fifth Edition Using LINQ Queries with an Access Database Table (cont’d.)

21Microsoft Visual C# 2012, Fifth Edition Using LINQ Queries with an Access Database Table (cont’d.)

22Microsoft Visual C# 2012, Fifth Edition Using LINQ Queries with an Access Database Table (cont’d.)

23Microsoft Visual C# 2012, Fifth Edition Using LINQ Queries with an Access Database Table (cont’d.)