CHAPTER EIGHT Accessing Data Processing Databases.

Slides:



Advertisements
Similar presentations
Data Base. Objective Become familiar with database terminology. Create a project to display data for a single database table. Use a DataGrid control.
Advertisements

Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Chapter 18 - Data sources and datasets 1 Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
VB.NET Database Access ISYS546. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Using ADO.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
3-1 Chapter 3 Data and Knowledge Management
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
VB.NET Database Access ISYS 812. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
1 Pertemuan 09 Database Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Information Technology in Organizations
Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Mgt 20600: IT Management & Applications Databases Tuesday April 4, 2006.
Page 1 ISMT E-120 Introduction to Microsoft Access & Relational Databases The Influence of Software and Hardware Technologies on Business Productivity.
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
Some Basic Database Terminology
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
COMPUTING FOR BUSINESS AND ECONOMICS-III. Lecture no.6 COURSE INSTRUCTOR- Ms. Tehseen SEMESTER- Summer 2010.
1 DATABASE TECHNOLOGIES BUS Abdou Illia, Fall 2007 (Week 3, Tuesday 9/4/2007)
Chapter 11 Introduction to Database Processing. Class 11: Database Processing Use a Visual Studio Wizard to establish a database connection used to load.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
ASP.NET Programming with C# and SQL Server First Edition
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
CHAPTER EIGHT Accessing Data Processing Databases.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Examining.
Introduction to Database Development Using Borland Data Providers 2128 Martin Rudy.
1 Introduction to ADO.NET Microsoft ADO.NET 2.0 Step by Step Rebecca M Riordan Microsoft Press, 2006.
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
6.1 © 2010 by Prentice Hall 6 Chapter Foundations of Business Intelligence: Databases and Information Management.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
1 Chapter 20 – Data sources and datasets Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Mauricio Featherman, Ph.D. Washington St. University
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
Databases and ADO.NET Programming Right from the Start with Visual Basic.NET 1/e 11.
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Module 3: Working with Local Data. Overview Using DataSets Using XML Using SQL Server CE.
HNDIT Rapid Application Development
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
Understand Relational Database Management Systems Software Development Fundamentals LESSON 6.1.
6.1 © 2007 by Prentice Hall Chapter 6 (Laudon & Laudon) Foundations of Business Intelligence: Databases and Information Management.
Module 2: Using ADO.NET to Access Data. Overview ADO.NET Architecture Creating an Application That Uses ADO.NET to Access Data Changing Database Records.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 350.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
CHAPTER NINE Accessing Data Using XML. McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction The eXtensible.
Chapter 9 Working with Databases. Copyright © 2011 Pearson Addison-Wesley Introduction In this chapter you will learn: – Basic database concepts – How.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 2 Objectives: Understanding and Creating Table.
Data Resource Management Data Concepts Database Management Types of Databases Chapter 5 McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies,
Databases and Information Management
Brief description on how to navigate within this presentation (ppt)
CIS16 Application Programming with Visual Basic
Databases and Information Management
Chapter 10 ADO.
Database Applications
Chapter 10 Accessing Database Files
Databases and Information Management
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

CHAPTER EIGHT Accessing Data Processing Databases

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction Data is efficiently managed by storing them in files on disk. Data files and programs are separate. The program does not need to be modified when the data changes. Different programs can share the same data sets.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction (cont.) Most businesses organize their data into databases. A database is an organizes collection of data. A database management system (DBMS) is a program that is used to create and maintain databases. Visual Basic.NET provides tools for developers to access databases from their programs.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Objectives Understand and use relational databases. Understand a subset of the ADO.NET object model. Apply the ADO.NET object model within Visual Basic.NET to access databases. Use the properties and methods of the DataGrid control to display record from a DataSet.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Objectives (cont.) Write SQL Select queries to extract data from a database. Bind controls such as TextBoxes and Labels to a DataSet. Create Master/Detail DataSets. Use several tools within Visual Basic.NET to manage and use databases.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved A Relational Database Primer Entities and Relationships –Every database contains: Entities – anything of interest to a business. Relationships – real-world associations between entities. –Database developers often use an entity- relationship diagram (ERD). To document a database’s structure. Symbols are used to designate relationships between entities.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved A Relational Database Primer (cont.) Relational Database Tables –A relational database stores the data for each entity in a table with rows and columns. –Compatible with Visual Basic.NET. –A key field guarantees the uniqueness of records. –A combination key is a key field with a combination of two or more fields.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved A Relational Database Primer (cont.) –One-to-Many Relationships Established by placing the key field of the “one” entity’s table into the “many” entity’s table as a foreign key. –Many-to-Many Relationships Constructed by creating a new table with the key fields from related tables.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved A Relational Database Primer (cont.) –Normalized Databases Normalization is a process used to eliminate or reduce data redundancy. Designers must determine which tables to place information in. A table should be in third normal form.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved A Relational Database Primer (cont.) Database Queries –Most relational database systems use a query language called structured query language (SQL). To specify how to combine data in related tables. To specify how to select only the desired data.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved An Introduction to ADO.NET Visual Basic.NET uses ADO.NET to manage data in a database. –ADO.NET (ActiveX Data Objects) uses an extensive set of classes to manage data. –This chapter covers the foundations of ADO.NET. –Also we will cover some of the wizards and tools provided to work with relational databases.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved An Introduction to ADO.NET (cont.) An Overview of ADO.NET –A DataProvider object directly interacts with a database and its DBMS. –A Connection object makes the physical connection to the database. –A DataAdapter acts as an intermediary between the database and the dataset. –A DataSet class holds the actual data. –A DataRelation includes information on how tables are related. –User interface components work directly with the DataSet.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved DataSet DataProvider User Interface Components DataBase DBMS DataTable DataRelation DataAdapter Connection

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Using ADO.NET with Visual Basic.NET Data Access Using the DataGrid Control –DB_sample1 –Provides a method of displaying records from a database in a grid-like manner. –Building the DataAdapter Create a DataAdapter by a wizard. –Building the DataSet Follow the procedure to create a DataSet.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Using ADO.NET with Visual Basic.NET (cont.) –Adding the DataGrid Follow the procedure to add a DataGrid to the form. Set the DataGrid properties to connect it to the DataAdapter and DataSet. Found on the Windows Form tab in the Toolbox. Will display fields specified in the SQL Select statement.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Using ADO.NET with Visual Basic.NET (cont.) The DataGrid Control –Designed to display the data stored in a DataSet. –An expander allows navigation from a parent table to a child table. –A detail list on p. 346 (Table 8.1)

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Using ADO.NET with Visual Basic.NET (cont.) –Properties AllowSortingCurrentCell AlternatingBackColorCurrentRowIndex (0 based) BackColorDataMember BackgroundColorDataSource BorderStyleEnabled CaptionBackColorFirstVisibleColumn CaptionFontForeColor CaptionForeColorGridLineColor CaptionTextGridLineStyle CaptionVisibleHeaderBackColor ColumnHeadersVisibleHeaderFont

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Using ADO.NET with Visual Basic.NET (cont.) –Properties (cont.) HeaderForeColor ParentRowsBackColor ParentRowsForeColor ParentRowsVisible PreferredColumnWidth ReadOnly RowHeadersVisible RowHeaderWidth SelectionBackColor SelectionForeColor

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved To set the current cell –DataGrid1.CurrentCell = New DataGridCell(1, 1)

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Using ADO.NET with Visual Basic.NET (cont.) –Methods Collapse(row) Expand(row) IsExpanded(row) IsSelected(row) Select(row) SetDataBinding(dataSourceObject, dataMemberString) UnSelect(row)

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Config Data Access without using Wizard DB_sample2 Create DataAdapter Create Connection Set up the SelectCommand, InsertCommand, UpdateCommand, DeleteCommand –Connection and CommandText properties Create DataSet

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Using ADO.NET with Visual Basic.NET (cont.) Updating a Table –ADO.NET provides support for table update. –Changes in the DataGrid can be relayed back to the original source data. –OleDbDataAdapter1.Update(DsStudents1) –DB_sample1 (with Update added)

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Using ADO.NET with Visual Basic.NET (cont.) Parameterized Queries –DB_sample3 –Users will often want to specify information that will determine the results of a query. –A parameter of a query could be a StudentID. –SELECT studentID, name FROM Students WHERE studentID = “S00001” –SELECT studentID, name FROM Students WHERE name = ?

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Using ADO.NET with Visual Basic.NET (cont.) Data binding refers to the process of associating one or more properties of a VB control to a specific data source. Simple data binding –Bound to a single data element (e.g. a field) Complex data binding –Bound to more than one data element in a dataset

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Using ADO.NET with Visual Basic.NET (cont.) Master/Detail Record Display –Here we examine a DataSet that includes two tables related to a common field. –A master/detail DataSet is a dataset with more than one table. –Each master record is related to zero or more records from the second table. –Parent and child terms may refer to master and detail records.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Additional Visual Basic.NET Database Tools We look at using the Server to work with databases. We show how to add a data connection to the server. The data connection will be used to create a data adapter and data set.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Chapter Summary A database is an organized collection of data and relationships that describe entities of interest to a business. An entity-relationship diagram (ERD) documents entities and their relationships. Visual Basic.NET supports the relational database approach for organizing data. Normalization is process used to minimize data redundancy.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Chapter Summary (cont.) Visual Basic.NET uses ADO.NET to access and manage databases. The DataGrid control is a control that can be bound to a specific dataset. Parameterized queries provide for the ability to determine how records will be selected at run time. Many of Visual Basic.NET’s controls can be bound to a dataset and its fields.

McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Chapter Summary (cont.) ADO.NET supports master/detail record relationships. The Server Explorer provides access and management tools for connections and servers.