Ch. 101 Changing the Contents of a Database. Ch. 102 Changing the Contents of a Database Data grid views can also be used to add, modify, and delete records.

Slides:



Advertisements
Similar presentations
Chapter 3 : Relational Model
Advertisements

Introduction to Structured Query Language (SQL)
Ch. 101 Virtual Table and DataGridView Virtual Table DataGridView.
Ch. 101 DataTable Data Table Object A DataTable object holds the contents of a table as a rectangular array. A data table is similar to a two-dimensional.
Maintenance Modifying the data –Add records –Delete records –Update records Modifying the design –Add fields into tables –Remove fields from a table –Change.
Introduction to Structured Query Language (SQL)
Introduction to Databases CIS 5.2. Where would you find info about yourself stored in a computer? College Physician’s office Library Grocery Store Dentist’s.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
Introduction to Structured Query Language (SQL)
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Concepts of Database Management Sixth Edition
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Microsoft Access 2010 Chapter 7 Using SQL.
INFORMATION TECHNOLOGY IN BUSINESS AND SOCIETY SESSION 16 – SQL SEAN J. TAYLOR.
Oracle Data Definition Language (DDL)
Chapter 10 - VB.Net by Schneider1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Relational Databases and SQL.
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
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.
With Microsoft Access 2007 Volume 1© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access 2007 Volume 1 Chapter.
Copyright © 2001 by Wiley. All rights reserved. Chapter 10: Advanced Database Operations Revising Vintage Videos Setting RecordSource at run time DBGrid.
Chapter 10 Queries and Updating Part C. SQL Copyright 2005 Radian Publishing Co.
CHAPTER 7 Database: SQL, MySQL. Topics  Introduction  Relational Database Model  Relational Database Overview: Books.mdb Database  SQL (Structured.
Microsoft Access 2010 Chapter 7 Using SQL. Change the font or font size for SQL queries Create SQL queries Include fields in SQL queries Include simple.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
Ch VB 2008 by Schneider1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Relational Databases and SQL.
Learningcomputer.com SQL Server 2008 – Entity Relationships in a Database.
P RACTICE Determine the output displayed when the button is clicked. Dim actor(5,5) As String Private Sub btnDisplay_Click(...) Handles btnDisplay.Click.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
Microsoft Access 2010 Building and Using Queries.
CHAPTER 8 Database: SQL, MySQL. Topics  Introduction  Relational Database Model  Relational Database Overview: Books.mdb Database  SQL (Structured.
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
Using Special Operators (LIKE and IN)
Concepts of Database Management Seventh Edition
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Ch Determine the output displayed from procedures Lab sheet 10.4.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Chapter 10 - VB.Net by Schneider1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Relational Databases and SQL.
Topic 1: Introduction to SQL. SQL stands for Structured Query Language. SQL is a standard computer language for accessing and manipulating databases SQL.
1 CSE 2337 Introduction to Data Management Access Book – Ch 1.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
1 SQL - II Data Constraints –Applying data constraints Types of data constraints –I/O constraints The PRIMARY KEY constraints The FOREIGN KEY constraints.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
ITEC 3220A Using and Designing Database Systems Instructor: Prof. Z. Yang Course Website: 3220a.htm
Constraints Lesson 8. Skills Matrix Constraints Domain Integrity: A domain refers to a column in a table. Domain integrity includes data types, rules,
1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Editing and Designing Databases.
Ch VB 2005 by Schneider1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Relational Databases and SQL.
Database: SQL, MySQL, LINQ and Java DB © by Pearson Education, Inc. All Rights Reserved.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
Chapter 3: Relational Databases
IMS 4212: Constraints & Triggers 1 Dr. Lawrence West, Management Dept., University of Central Florida Stored Procedures in SQL Server.
Ch. 101 DataTable (Continue) Lab sheet 10.3: Form Display Cities table along with percentage growth.
SQL: Structured Query Language It enables to create and operate on relational databases, which are sets of related information stored in tables. It is.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
Constraints Advanced Database Systems Dr. AlaaEddin Almabhouh.
MySQL Tutorial. Databases A database is a container that groups together a series of tables within a single structure Each database can contain 1 or more.
VOCAB REVIEW. A field that can be computed from other fields Calculated field Click for the answer Next Question.
Oracle 11g: SQL Chapter 5 Data Manipulation and Transaction Control.
COM621: Advanced Interactive Web Development Lecture 11 MySQL – Data Manipulation Language.
Fundamentals of DBMS Notes-1.
Database Access with SQL
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
CIS16 Application Programming with Visual Basic
Chapter 10 – Database Management
CS122 Using Relational Databases and SQL
Shelly Cashman: Microsoft Access 2016
Presentation transcript:

Ch. 101 Changing the Contents of a Database

Ch. 102 Changing the Contents of a Database Data grid views can also be used to add, modify, and delete records from a database. After a DataAdapter has been created, the statement Dim commandBuilder As New _ OleDbCommandBuilder(dataAdapter) will automatically generate the commands used for the Insert, Update, and Delete operations.

Ch. 103 Using the DataAdapter to Change a Database If changes is an Integer variable, then the statement changes = dataAdapter.Update(dt) will store all of the insertions, updates, and deletions made in the data table to the database and assign the number of records changed to the variable changes.

Ch. 104 Lab sheet 10.7: Form dgvDisplay

Ch. 105 Lab sheet 10.7: Partial Code Dim connStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=MEGACITIES.MDB" Dim sqlStr As String = "SELECT * FROM Cities" Dim dt As New DataTable() Private Sub btnLoad_Click(...) Handles btnLoad.Click dt.Clear() Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr, connStr) dataAdapter.Fill(dt) dataAdapter.Dispose() dgvDisplay.DataSource = dt End Sub

Ch. 106 Lab sheet 10.7: Code continued Private Sub btnSave_Click(...) Handles btnSave.Click Dim changes As Integer Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr, connStr) Dim commandBuilder As New _ OleDb.OleDbCommandBuilder(dataAdapter) changes = dataAdapter.Update(dt) dataAdapter.Dispose() If changes > 0 Then MsgBox(changes & " changed rows stored in the database.") Else MsgBox("No changes made.") End If End Sub

Ch. 107 Calculated Columns with SQL In the SQL statement SELECT field1, field2,..., fieldN FROM Table1 one of the fields mentioned can consist of an expression Involving other fields, followed by a clause of the form “AS column header”. If so, a new column will be created whose values are determined by the expression and having the stated header. For instance, using the string sqlStr = "SELECT city, Round(pop2015-pop2005, 1)" & _ "AS popGrowth FROM Cities" to fill the table produces the output shown in slide 66.

Ch. 108 Calculated Columns with SQL

Ch. 109 Comments 1.There is a one-to-many relationship from the Countries table to the Cities table since each record of the Countries table is related to one or more records of the Cities table, and each record of the Cities table is related to only one record of the Countries table. 2.SQL statements are case insensitive. 3.When the Like operator is used, the “pattern” must appear on the right of the operator. SELECT * FROM Cities WHERE city Like 'S%'

Ch Comments continued 4.An expression such as “[letter1-letter2]” is a placeholder for any letter from letter1 to letter2. Example: the pattern “[A-F]ad” is matched by Bad and Dad, but not Sad. 5.When Like is used in SQL statements, it is case insensitive. That is, (‘bad’ Like ‘[A-F]ad’) is True. When Like is used in an If block, the asterisk is used instead of the percent sign to denote any number of characters, and the question mark stands for any one character.

Ch Comments continued 6.The requirement that no record may have a null primary key and that entries for primary keys be unique is called the Rule of Entity Integrity.