Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET

Slides:



Advertisements
Similar presentations
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Advertisements

Chapter 8 Embedded SQL.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
1 Chapter 12 Working With Access 2000 on the Internet.
Integrating Access with the Web and with Other Programs.
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.
Object-Oriented Application Development Using VB.NET 1 Chapter 13 Introduction to Data Access Classes and Persistence.
1 CA201 Word Application Creating Document for the Web Week # 9 By Tariq Ibn Aziz Dammam Community college.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
A Guide to SQL, Seventh Edition. Objectives Embed SQL commands in PL/SQL programs Retrieve single rows using embedded SQL Update a table using embedded.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 13: Advanced GUI and Graphics
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
1 Chapter 20 — Creating Web Projects Microsoft Visual Basic.NET, Introduction to Programming.
Chapter 15 - Creating More Complex Database Applications 1 Chapter 15 Creating More Complex Database Applications.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
A First Program Using C#
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
ASP.NET Programming with C# and SQL Server First Edition
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
Chapter 15: Using LINQ to Access Data in C# Programs.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Examining.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
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.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
Chapter 14 - Designing Data Access Classes1 Chapter 14 Designing Data Access Classes.
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
Databases and ADO.NET Programming Right from the Start with Visual Basic.NET 1/e 11.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 8 1 Microsoft Office Access 2003 Tutorial 8 – Integrating Access with the.
Object-Oriented Application Development Using VB.NET 1 Chapter 13 Introduction to Data Access Classes and Persistence.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Object-Oriented Application Development Using VB.NET 1 Chapter 15 Assembling a Three-Tier Windows Application.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 2 Objectives: Understanding and Creating Table.
ASP.NET Programming with C# and SQL Server First Edition
Microsoft Visual Basic 2010: Reloaded Fourth Edition
A Guide to SQL, Seventh Edition
Working in the Forms Developer Environment
IS444: Modern tools for applications development
IS444: Modern tools for applications development
CIS16 Application Programming with Visual Basic
Microsoft Office Access 2003
Microsoft Office Access 2003
Creating More Complex Database Applications
Presentation transcript:

Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design Objectives Explore the relational database model Construct database queries using SQL Write VB .NET programs that interact with a relational database Explore ASP.NET Visual Basic .NET Programming: From Problem Analysis to Program Design

Exploring the Relational Database Model Real-world applications require data persistence VB .NET provides several mechanisms Sequential files Relational database Visual Basic .NET Programming: From Problem Analysis to Program Design

Understanding Tables, Rows, Columns, and Primary and Foreign Keys Organize data Relational database consists of many different tables Related to each other in some way Consist of Rows Columns Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design Understanding Tables, Rows, Columns, and Primary and Foreign Keys (continued) Rows Records Instances Columns Attributes Fields Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design Understanding Tables, Rows, Columns, and Primary and Foreign Keys (continued) Primary key Field that uniquely identifies each record Good database design calls for primary key whose Value is not likely to change over time Value is not null for any instance Can add unique identifying attribute to table Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design Understanding Tables, Rows, Columns, and Primary and Foreign Keys (continued) Foreign key Links information in one table to information in another table Must be primary key in other table Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Mapping PD Attributes to Database Tables Many different choices for organizing attributes into relational tables Attributes can be mapped to more than one table Can add fields that were not originally contained in PD class Seldom single choice Weigh benefits and drawbacks of several possible designs Choose design that best fits needs of application Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Constructing Queries Using SQL Query Request for information. Usually specifies one or more conditions that extracted information must meet Can be written in Structured Query Language SQL Visual Basic .NET Programming: From Problem Analysis to Program Design

Constructing Queries Using SQL (continued) Enables you to perform other common database operation Insert Update Delete Visual Basic .NET Programming: From Problem Analysis to Program Design

Extracting Records from a Database SELECT statement. Format: SELECT attribute1, attribute2, ... , attributeN FROM table WHERE condition Each attribute specifies name of column Table specifies name of table Condition specifies criteria for selecting records from table Visual Basic .NET Programming: From Problem Analysis to Program Design

Extracting Records from a Database (continued) SELECT statement Example: SELECT FirstName, LastName FROM Customer WHERE State = ‘GA’ Can use keywords AND and OR To specify compound conditions Extract attributes from multiple tables Visual Basic .NET Programming: From Problem Analysis to Program Design

Inserting Records into a Database INSERT statement Formats: INSERT INTO table VALUES (value1, value2, ... , valueN) INSERT INTO table (attribute1, attribute2, ... , attributeN) VALUES (value1, value2, ... , valueN) First format Must know order of fields in underlying table Visual Basic .NET Programming: From Problem Analysis to Program Design

Inserting Records into a Database (continued) INSERT statement Example: INSERT INTO Customer VALUES ('51954', 'John', 'Doe', 'Miami', 'FL', '345-6789') Visual Basic .NET Programming: From Problem Analysis to Program Design

Updating Records in a Database UPDATE statement Format: UPDATE table SET attribute1=value1, attribute2=value2, ..., attributeN=valueN WHERE condition SET clause Assign values to each attribute to be modified Visual Basic .NET Programming: From Problem Analysis to Program Design

Updating Records in a Database (continued) UPDATE statement (continued) WHERE clause Specifies to which record UPDATE command applies Example: UPDATE Customer SET State = 'Georgia' WHERE State = 'GA' Visual Basic .NET Programming: From Problem Analysis to Program Design

Deleting Records from a Database DELETE statement Format: DELETE FROM table WHERE condition WHERE clause Specifies conditions that determine record to delete Example: DELETE FROM Customer WHERE State = 'Georgia' Visual Basic .NET Programming: From Problem Analysis to Program Design

Writing VB .NET Programs that Interact with a Relational Database VB .NET Framework provides support for several database management systems including: Oracle Microsoft Access Microsoft SQLServer Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design Writing VB .NET Programs that Interact with a Relational Database (continued) Data providers Used to Connect to database Execute commands, Retrieve results Namespaces: System.Data System.Data.OleDb Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Understanding the Examples in this Section Build on Programming Example presented at end of Chapter 13 Integrated system Adding students and professors to database Producing lists of students and professors. Extends functionality to allow updating/deleting Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Understanding the Examples in this Section (continued) Three-tier design PD and GUI classes are unaware of how DA class implements data persistence DA class handles all interaction with database and carries out tasks of: Inserting Updating Deleting Extracting information Visual Basic .NET Programming: From Problem Analysis to Program Design

Understanding the Examples in this Section (continued) Three-tier design GUI classes that capture and display information simply invoke DA methods Visual Basic .NET Programming: From Problem Analysis to Program Design

Making the StudentDA Class Work with an Access Database Import namespaces that provide functionality to interact with Microsoft Access database Initialize method Creates and opens connection to database Attempt to open connection is enclosed within Try- Catch block Visual Basic .NET Programming: From Problem Analysis to Program Design

Making the StudentDA Class Work with an Access Database (continued) GetAll method Issues SELECT command to retrieve all records from database General approach for executing SELECT command: Create data set instance Create data adapter instance Visual Basic .NET Programming: From Problem Analysis to Program Design

Making the StudentDA Class Work with an Access Database (continued) General approach for executing SELECT command (continued): Define String variable containing SELECT statement Use SelectCommand property of data adapter to create command instance and execute command against database Invoke Fill method of data adapter class to populate data set Visual Basic .NET Programming: From Problem Analysis to Program Design

Making the StudentDA Class Work with an Access Database (continued) Find method Nearly identical to GetAll method SELECT statement issued within Find method returns at most one record AddNew method Insert new record into database Visual Basic .NET Programming: From Problem Analysis to Program Design

Making the StudentDA Class Work with an Access Database (continued) To create and execute INSERT command in VB.NET: Create data adapter instance Create instance of OleDbCommand class Assign instance to data adapter’s InsertCommand Invoke ExecuteNonQuery method of OleDbCommand class Visual Basic .NET Programming: From Problem Analysis to Program Design

Making the StudentDA Class Work with an Access Database (continued) Update method Similar to AddNew method. Defines SQL statement to update database Delete method Defines SQL DELETE statement Deletes record from database Terminate method Closes database connection Visual Basic .NET Programming: From Problem Analysis to Program Design

Making the StudentDA Class Work with an Access Database (continued) Exception classes: NotFoundException DuplicateException Visual Basic .NET Programming: From Problem Analysis to Program Design

Recognizing the Benefits of the Three-Tier Design Very little change required to PD and GUI classes To make them work with new StudentDA class Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design Programming Example: Updating and Deleting Records in a Relational Database Demonstrates how to update and delete records from relational database in three-tier design Using methods of StudentDA class Benefit of three-tier design Add new GUIs without having to make changes in PD and DA tiers Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design Introducing ASP.NET ASP.NET Used to write interactive web pages Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design Reviewing Web Basics Hypertext Markup Language (HTML) Employed by web pages Enables browsers to display Web pages on variety of computing platforms Descriptive language Uniform Resource Locator (URL) ASP.NET Can contain HTML and related files containing code to provide interactivity Visual Basic .NET Programming: From Problem Analysis to Program Design

Reviewing Web Basics (continued) Web pages Actual files containing HTML code Have extension of .htm or .html Contains tags that define format of Web page Can be created using any text editor Such as Notepad Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Creating ASP.NET Projects NET Framework provides tools to develop both Windows applications Web applications ASP.NET separates procedural code from Web form (HTML) code: Web form file has suffix of .aspx, Code file has suffix .vb Called code-behind file Visual Basic .NET Programming: From Problem Analysis to Program Design

Creating ASP.NET Projects (continued) In new projects dialog box in Visual Studio .NET Choose ASP.NET Web Application template Use Toolbox to add form components Display Web Forms or HTML sections Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Creating ASP.NET Projects (continued) Validation controls Facilitate adding data validation Appear in Toolbox Can be placed on Web page just as any other controls Properties can be accessed in Properties window Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design

Programming Example: Electricity Billing Deploys Electricity Billing Programming Example at end of Chapter 10 As ASP.NET Web-based application GUI Inputs and validates Customer Number Previous, and Current Meter Readings Visual Basic .NET Programming: From Problem Analysis to Program Design

Programming Example: Electricity Billing (continued) Data validation: Customer Number is required Previous Reading is required Must be in range 0–99999 Current Reading is required Must be greater than or equal to Previous Reading Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design Summary Applications require data to be persistent Use relational databases Relational database Enables you to organize data into tables Primary key Field that uniquely identifies each record in table Query Request for information Visual Basic .NET Programming: From Problem Analysis to Program Design

Visual Basic .NET Programming: From Problem Analysis to Program Design Summary (continued) Structured Query Language (SQL) Allows you to specify queries Three-tier design PD and GUI classes are unaware of how data DA class implements data persistence Web development using ASP.NET is similar to developing GUI applications for Windows ASP.NET separates procedural code from Web form (HTML) code Visual Basic .NET Programming: From Problem Analysis to Program Design