 2000 Deitel & Associates, Inc. All rights reserved. Chapter 25 – Database: SQL, ADO and RDS Outline 25.1Introduction 25.2Relational Database Model 25.3Relational.

Slides:



Advertisements
Similar presentations
 2003 Prentice Hall, Inc. All rights reserved. Chapter 22 – Database: SQL, MySQL, DBI and ADO.NET Outline 22.1 Introduction 22.2 Relational Database Model.
Advertisements

 Pearson Education, Inc. All rights reserved Accessing Databases with JDBC.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Introduction to Structured Query Language (SQL)
1 Introduction to Web Application Introduction to Data Base.
Introduction to Structured Query Language (SQL)
Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Concepts of Database Management Sixth Edition
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ 1 Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
© 1999, by Que Education and Training, Chapter 11, pages of Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach.
Chapter 10 - VB.Net by Schneider1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Relational Databases and SQL.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Java Database Connectivity (JDBC). Introduction Database –Collection of data DBMS –Database management system –Storing and organizing data SQL –Relational.
Databases and LINQ Visual Basic 2010 How to Program 1.
Databases C HAPTER Chapter 10: Databases2 Databases and Structured Fields  A database is a collection of information –Typically stored as computer.
ASP.NET Programming with C# and SQL Server First Edition
Jaeki Song JAVA Lecture 11 Java Database Connectivity.
Using the Select Case Statement and the MsgBox Function (Unit 8)
CSE470 Software Engineering Fall Database Access through Java.
Intro to JDBC To effectively use Java Data Base Connectivity we must understand: 1.Relational Database Management Systems (RDBMS) 2.JDBC Drivers 3.SQL.
Copyright © 2001 by Wiley. All rights reserved. Chapter 10: Advanced Database Operations Revising Vintage Videos Setting RecordSource at run time DBGrid.
 2008 Pearson Education, Inc. All rights reserved Database: SQL, MySQL, ADO.NET 2.0 and Java DB.
CHAPTER 7 Database: SQL, MySQL. Topics  Introduction  Relational Database Model  Relational Database Overview: Books.mdb Database  SQL (Structured.
A CCESSING D ATABASES WITH JDBC CH 24 C S 442: A DVANCED J AVA P ROGRAMMING.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
Using Visual Basic 6.0 to Create Web-Based Database Applications
 2003 Prentice Hall, Inc. All rights reserved. 1 Java Database Connectivity with JDBC TM.
CIS 270—Application Development II Chapter 25—Accessing Databases with JDBC.
CHAPTER 8 Database: SQL, MySQL. Topics  Introduction  Relational Database Model  Relational Database Overview: Books.mdb Database  SQL (Structured.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
CSC 411/511: DBMS Design Dr. Nan WangCSC411_L12_JDBC_MySQL 1 MySQL and JDBC.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
Database: SQL and MySQL
1 Databases November 15, 2005 Slides modified from Internet & World Wide Web: How to Program (3rd) edition. By Deitel, Deitel, and Goldberg. Published.
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
Database, SQL, and ADO.NET- Part 1 Session 11 Mata kuliah: M0874 – Programming II Tahun: 2010.
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.
Databases MIS 21. Some database terminology  Database: integrated collection of data  Database Management System (DBMS): environment that provides mechanisms.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
3-Tier Client/Server Internet Example. TIER 1 - User interface and navigation Labeled Tier 1 in the following graphic, this layer comprises the entire.
Tutorial 91 Databases A database is an organized collection of related information stored in a file on a disk A database allows companies to store information.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
A CCESSING D ATABASES WITH JDBC CH 24 C S 442: A DVANCED J AVA P ROGRAMMING.
 2008 Pearson Education, Inc. All rights reserved Database: SQL, MySQL, ADO.NET 2.0 and Java DB.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 22 - SQL, MySQL, DBI and ADO Outline 22.1 Introduction 22.2 Relational Database Model 22.3 Relational.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
 2009 Pearson Education, Inc. All rights reserved Databases and LINQ to SQL.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
Database: SQL, MySQL, LINQ and Java DB © by Pearson Education, Inc. All Rights Reserved.
LINQ to DATABASE-2.  Creating the BooksDataContext  The code combines data from the three tables in the Books database and displays the relationships.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
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.
ORDER BY Clause The result of a query can be sorted in ascending or descending order using the optional ORDER BY clause. The simplest form of.
Database, SQL and ADO.NET
CHAPTER 7 DATABASE ACCESS THROUGH WEB
Visual Basic 2010 How to Program
Database Programming in Java
 2012 Pearson Education, Inc. All rights reserved.
Basic select statement
JDBC.
Databases Intro (from Deitel)
Chapter 22 - SQL, MySQL, DBI and ADO
Lecture 11 Database Connection
Java Chapter 6 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

 2000 Deitel & Associates, Inc. All rights reserved. Chapter 25 – Database: SQL, ADO and RDS Outline 25.1Introduction 25.2Relational Database Model 25.3Relational Database Overview: Books.mdb 25.4Structured Query Language Basic SELECT Query WHERE Clause ORDER BY Clause Using INNER JOIN to Merge Data from Multiple Tables TitleAuthor Query from Books.mdb Inserting a Record Updating a Record 25.5Registering Books.mdb as an ODBC Source 25.6ActiveX Data Objects (ADO) 25.7Remote Data Services (RDS

 2000 Deitel & Associates, Inc. All rights reserved Introduction Database –Integrated collection of data Database Management System (DBMS) –Has mechanisms for storing and organizing data –Sophisticated queries and manipulations of data Relational Databases –Most popular database system in use today Structured Query Language (SQL – pronounced “sequel”) –Almost universally used with relational databases –Makes queries (request information) and manipulate data

 2000 Deitel & Associates, Inc. All rights reserved Introduction (II) In this chapter –Presentation of basic SQL queries using a database –Introduction of two Microsoft technologies ActiveX Data Objects (ADO) Remote Data Services (RDS) These two technologies –Enable client browser to Retrieve information from a database on a Web server Process that information on the client computer Return modifications of the data to the Web server so that the data can be updated in the database Manipulation of data in the client –Increases performance of Web-based database applications –Reduces overall load on the server computer

 2000 Deitel & Associates, Inc. All rights reserved Relational Database Model Relational Database Model –Logical representation of the data –Consider relationships between data without worrying about physical implementation Relational Database –Composed of tables –Any row of the table is called a record –The first field is used as the primary key for referencing Records are normally unique (by primary key) Primary key can be composed of more than one field or column –Each column represents a different field (or attribute)

 2000 Deitel & Associates, Inc. All rights reserved Relational Database Model (II) Relational Database Structure NumberNameDepartmentSalaryLocation JONES, A. KERWIN, R. LARSON, P. MYERS, B. NEUMANN, C. STEPHENS, T NEW JERSEY LOS ANGELES ORLANDO NEW JERSEY ORLANDO Table: Employee A record A columnPrimary Key

 2000 Deitel & Associates, Inc. All rights reserved Relational Database Model (III) Different users interested in different parts of the table –SQL statements specify the data to select from the table SQL –Provides complete set of keywords –Smaller databases can also be combined to form larger ones –Results of a query called result sets (or record sets) Example: Result set to show where departments are located Department Location NEW JERSEY LOS ANGELES ORLANDO

 2000 Deitel & Associates, Inc. All rights reserved Relational Database Overview: Books.mdb Overview of Database Books.mdb –This database will be used throughout the chapter to introduce Various database concepts Use of SQL to obtain useful information from the database and to manipulate the database –Books.mdb consists of four tables: Authors, Publishers, AuthorISBN and Titles Primary key for each table is shown in italics

 2000 Deitel & Associates, Inc. All rights reserved Relational Database Overview: Books.mdb (II) Authors table description –AuthorID Integer representing author’s ID number in database (primary key) –FirstName String representing author’s first name –LastName String representing author’s last name –YearBorn String representing author’s year of birth Authors table data

 2000 Deitel & Associates, Inc. All rights reserved Relational Database Overview: Books.mdb (III) Publishers table description –PublisherID Integer representing publisher’s ID number in database (primary key) –PublisherName String representing abbreviated name for publisher Publishers table data

 2000 Deitel & Associates, Inc. All rights reserved. AuthorISBN table description –ISBN String representing ISBN number for a book (linking table - no primary key) –AuthorID Integer representing author’s ID number 25.3 Relational Database Overview: Books.mdb (IV)

 2000 Deitel & Associates, Inc. All rights reserved Relational Database Overview: Books.mdb (V) AuthorISBN table data

 2000 Deitel & Associates, Inc. All rights reserved Relational Database Overview: Books.mdb (VI) Titles table description –ISBN String representing ISBN number of the book (primary key) –Title String representing title of the book –EditionNumber String representing edition of the book –YearPublished String representing year in which book was published –Description String representing description of the book –PublisherID Integer representing publisher’s ID number (corresponds to ID number in Publishers table)

 2000 Deitel & Associates, Inc. All rights reserved. Titles table data 25.3 Relational Database Overview: Books.mdb (VII)

 2000 Deitel & Associates, Inc. All rights reserved. Table relationships in books.mdb Lines between tables represent relationships –Example: Line between Publishers and Titles One-to-many relationship Every publisher can have an infinite number of books –PublisherID is the foreign key in the Titles table Must correspond to primary key in Publishers table Maintains Rule of Referential Integrity AuthorISBN table- –No primary key –Linking table between Titles and Authors

 2000 Deitel & Associates, Inc. All rights reserved Structured Query Language Structured Query Language (SQL) keywords used to –Query a database –Insert records into a database –Update existing records in a database

 2000 Deitel & Associates, Inc. All rights reserved Basic SELECT Query SELECT * FROM TableName –TableName specifies table in database where data is located –* selects all rows and fields from TableName SELECT * FROM Authors –Selects the entire contents of the Authors table SELECT AuthorID, LastName FROM Authors –To select fields from table, replace * with comma-separated list of field names to select –Returns the following:

 2000 Deitel & Associates, Inc. All rights reserved Basic SELECT Query (II) Order of fields –Specifying field names ensures that the fields are returned in the same order, even if in different order in the table Allows result set to be processed more efficiently by the application –SQL statement using * does not ensure that fields will be returned in the expected order Do not use to specify field names to select from one or several table Field name with spaces –If contains spaces, must be enclosed in square brackets ( [] ) Error if you forget to enclose in brackets Therefore, try to avoid field names with spaces

 2000 Deitel & Associates, Inc. All rights reserved WHERE Clause WHERE clause –Most cases, only necessary to locate records that satisfy certain selection criteria –SQL uses the WHERE clause to specify the selection criteria –Can contain operators, =, =, <> and LIKE Simplest form: SELECT fieldName1, fieldName2, … FROM TableName WHERE Criteria SQL is case-sensitive on some systems –Check your database system document to determine the syntax to be used for keywords All uppercase, all lowercase, combination?

 2000 Deitel & Associates, Inc. All rights reserved WHERE Clause (II) Example SELECT AuthorID, FirstName, LastName, YearBorn FROM Authors WHERE YearBorn > 1960 Returns

 2000 Deitel & Associates, Inc. All rights reserved WHERE Clause (III) LIKE Operator –Used for pattern matching with wildcard characters asterisk ( * ) question mark ( ? ) –Allows SQL to search for similar strings that “match a pattern” –Asterisk Indicates any number of characters in a row at location in pattern Surrounded by single-quote characters –Question Mark Indicates a single character at that position in the pattern Surrounded by single-quote characters –Not supported by all database systems

 2000 Deitel & Associates, Inc. All rights reserved WHERE Clause (IV) LIKE Operator Example SELECT AuthorID, FirstName, LastName, YearBorn FROM Authors WHERE Lastname LIKE ‘d*’ –Returns records of all authors whose last name’s begin with the letter d

 2000 Deitel & Associates, Inc. All rights reserved WHERE Clause (V) LIKE Operator Example II SELECT AuthorID, FirstName, LastName, YearBorn FROM Authors WHERE Lastname LIKE ‘?i*’ –Returns records of all authors whose last name second letter is the letter i

 2000 Deitel & Associates, Inc. All rights reserved WHERE Clause (VI) LIKE Operator Example III –Query can be specialized to allow any character in a range of characters in one position in the string [ startValue - endValue ] SELECT AuthorID, FirstName, LastName, YearBorn FROM Authors WHERE Lastname LIKE ‘?[a-i]*’ –Returns records of all authors in table because all fit range

 2000 Deitel & Associates, Inc. All rights reserved ORDER BY Clause ORDER BY Clause –Sorts results of query into ascending or descending order SELECT fieldName1, fieldName2, … FROM TableName ORDER BY fieldName ASC SELECT fieldName1, fieldName2, … FROM TableName ORDER BY fieldName DESC Example SELECT AuthorID, FirstName, LastName, YearBorn FROM Authors ORDER BY LastName ASC –Returns authors sorted by last name in ascending order

 2000 Deitel & Associates, Inc. All rights reserved ORDER BY Clause (II) The WHERE and ORDER BY clauses can be combined –Example: SELECT ISBN, Title, EditionNumber, YearPublished, PublisherID FROM Titles WHERE Title LIKE ‘*How to Program’ ORDER BY Title ASC –Returns:

 2000 Deitel & Associates, Inc. All rights reserved ORDER BY Clause (III) ORDER BY can be applied to multiple fields ORDER BY fieldName1 SortingOrder, fieldName2 SortingOrder, … When we construct a query –Create one long string containing query –Multiple lines and indentation only used for readability when query statement is displayed in text

 2000 Deitel & Associates, Inc. All rights reserved Using INNER JOIN to Merge Data from Multiple Tables INNER JOIN Clause –Merges data from multiple tables into single view –Referred to as joining the tables –Placed in the FROM clause of an SQL query Simplest form SELECT fieldName1, fieldName2, … FROM Table1 INNER JOIN Table2 ON Table1.field = Table2.field

 2000 Deitel & Associates, Inc. All rights reserved Using INNER JOIN to Merge Data from Multiple Tables (II) ON part of INNER JOIN –Specifies fields from each table to be compared to determine records to be selected –“TableName.” syntax required if fields have same name in both tables –Example: SELECT FirstName, LastName, ISBN FROM Authors INNER JOIN AuthorISBN ON Authors.AuthorID = AuthorISBN.AuthorID ORDER BY LastName, FirstName

 2000 Deitel & Associates, Inc. All rights reserved Using INNER JOIN to Merge Data from Multiple Tables (III)

 2000 Deitel & Associates, Inc. All rights reserved TitleAuthor Query from Books.mdb Predefined query: TitleAuthor –Table containing book title, ISBN number, author’s first and last names, year published, and publisher’s name –Note the nested INNER JOIN structures –Note: spacing and indenting only for readability SELECT Titles.Title, Titles.ISBN, Authors.FirstName, Authors.Lastname, Titles.YearPublished, Publishers.PublisherName FROM ( Publishers INNER JOIN Titles ON Publishers.PublisherID = Titles.PublisherID ) INNER JOIN ( Authors INNER JOIN AuthorsISBN ON Authors.AuthorID = AuthorISBN.AuthorID ) ON Titles.ISBN = AuthorsISBN.ISBN ORDER BY Titles.Title

 2000 Deitel & Associates, Inc. All rights reserved TitleAuthor Query from Books.mdb (II) Portions of TitleAuthor query output

 2000 Deitel & Associates, Inc. All rights reserved Inserting a Record INSERT INTO operation –Inserts data into the table (e.g; adds a record) –Simplest form: –The single quote character should be used as a delimiter for strings to be inserted into the database INSERT INTO TableName ( fieldName1, fieldName2, …, fieldNameN ) Values ( value1, value 2, …, valueN ) Values to be inserted into fields – in order of fields listed before Table into which record will be inserted List of field names into which to insert values (not required if inserting complete record) KEYWORDS

 2000 Deitel & Associates, Inc. All rights reserved Inserting a Record Sample insert operation –Note: AuthorID field not specified because it has been set up in Microsoft Access, our database software, as an auto-numbered field INSERT INTO Authors ( FirstName, LastName, YearBorn ) Values ( ‘Sue’, ‘Smith’, 1960 ) Result

 2000 Deitel & Associates, Inc. All rights reserved Updating a Record Modify a record with the UPDATE operation UPDATE TableName SET fieldName1 = value1, fieldName2 = value2, …, fieldNameN = valueN WHERE criteria Example: UPDATE Authors SET YearBorn = 1969 WHERE LastName = ‘Deitel’, FirstName = ‘Paul’ –Changes YearBorn value for Paul Deitel in Authors table to 1969

 2000 Deitel & Associates, Inc. All rights reserved Registering Books.mdb as an ODBC Data Source Open DataBase Connectivity (ODBC) Application Programming Interface (API) –Developed by Microsoft to allow Windows applications to communicate in a uniform manner with relational databases To execute an SQL query –Program must be able to access the database Database must be given a System Data Source Name (DSN) on the server Database must be registered as an ODBC source ODBC Driver written by vendors –Uses ODBC API to provide uniform access to the database For specific instructions –See section 25.5 in your textbook

 2000 Deitel & Associates, Inc. All rights reserved ActiveX Data Objects (ADO) Microsoft’s Universal Data Access (UDA) –Architecture designed for high-performance data access to Relational data sources Non-relational data sources Mainframe/legacy data sources UDA Architecture: Application or Browser ADO ODB C OLE DB Relational data sources Non-relational data sources Mainframe/legacy data

 2000 Deitel & Associates, Inc. All rights reserved ActiveX Data Objects (ADO) UDA consists of three primary components –OLE DB Core of UDA architecture Provides low-level access to any data source –ODBC C programming language library Uses SQL to access data –ActiveX Data Controls Simple object model Provides uniform access to any data source by interacting with OLE DB

 2000 Deitel & Associates, Inc. All rights reserved ActiveX Data Objects (ADO) ADO object model –Provides objects and collections

 2000 Deitel & Associates, Inc. All rights reserved Remote Data Services (RDS) RDS –Emerging Microsoft technology for client-side database manipulation over the internet –Recordsets retrieved on the server using ADO and sent to client browser Called disconnected recordset –Client can execute queries against the recordset –Similar to Tabular Data Control RDS provides mechanism for sending updated records to Web server Tabular Data Control does not RDS is still developing –Future releases will work with Personal Web Server (PWS) –Server-side setup complex and developing rapidly

 2000 Deitel & Associates, Inc. All rights reserved Remote Data Services (RDS) (II) RDS Architecture RDS still developing –Future releases will work with PWS –Server-side setup complex and developing rapidly ADO ODB C OLE DB Relational data sources Non-relational data sources Mainframe/legacy data PWS/IIS Server Client Browser RDS

 2000 Deitel & Associates, Inc. All rights reserved Remote Data Services (RDS) (III) RDS implemented as client-side ActiveX control –Named RDS.Datacontrol Properties Table Methods Table

 2000 Deitel & Associates, Inc. All rights reserved Remote Data Services (RDS) (IV) RDS.Datacontrol –Transfers data asynchronously Transfer occurs in parallel with other executing code ReadyState property stores control’s current state –Uses constants to declare state s used in the program –state can have one of three values 0 – no user activity 1 – download state 2 – upload state

 2000 Deitel & Associates, Inc. All rights reserved. Outline 1.1 Define OBJECT 2.1 Open and define tag 2.2 Set predefined ReadyState constants 2.3 Set Initial StatusText.Value 3.1 Define deitelDC_OnReadySt ateChange() Sub procedure 3.2 Open Select structure inside if structure for downloading actions <OBJECT CLASSID = "clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" 7 ID = deitelDC WIDTH = 0 HEIGHT = 0> <!-- 12Option Explicit Const adcReadyStateLoaded = 2 16Const adcReadyStateInteractive = 3 17Const adcReadyStateComplete = Dim state 20 21Public Sub window_OnLoad() 22 ’ Set the state machine at the first state 23 StatusText.Value = "Click Find." 24 state = 0 25End Sub 26 27Public Sub deitelDC_OnReadyStateChange() 28 If state = 1 Then 29 Select Case deitelDC.ReadyState 30 ’ Just started downloading, there is no 31 ’ data to look at.

 2000 Deitel & Associates, Inc. All rights reserved. Outline 3.3 set StatusText.value downloading 3.4 Fill in fields for updating 3.5 Set final StatusText.Value downloading value 4.1 Open select structure inside ElseIf structure for uploading 4.2 Set first StatusText.value output for uploading Case 32 Case adcReadyStateLoaded 33 StatusText.Value = "Downloading..." ’ Partially downloaded the data, 36 ’ there is more to come. 37 Case adcReadyStateInteractive 38 StatusText.Value = "Still downloading..." ’ Completely downloaded the data, 41 ’ there’s no more coming. 42 Case adcReadyStateComplete ’ Fill in the fields for updating 45 ’ Get ISBN field to prove we got the right one 46 FoundISBN.Value = deitelDC.Recordset( "ISBN" ) ’ The title we want to modify 49 FoundTitle.Value = deitelDC.Recordset( "Title" ) ’ OK for updating. Everything worked. 52 StatusText.Value = "Finished downloading." 53 state = 2 54 End Select ElseIf state = 2 Then Select Case deitelDC.ReadyState 59 ’ Started uploading, there is no data sent. 60 Case adcReadyStateLoaded 61 ’ OK for updating. Everything worked. 62 StatusText.Value = "Uploading..."

 2000 Deitel & Associates, Inc. All rights reserved. Outline 4.3 Finish setting StatusText.value ’s for uploading 4.4 Close all structures 5.1 Define OnClick() Sub procedure 5.2 Validate input values ’ Partially uploaded the data, there is more to send. 65 Case adcReadyStateInteractive 66 ’ OK for updating. Everything worked. 67 StatusText.value = "Still Uploading..." ’ Completely downloaded the data, 70 ’ there is no more coming. 71 ’ Goto readystate = complete if it works 72 Case adcReadyStateComplete 73 ’ OK for updating. Everything worked. 74 StatusText.value = "Finished updating." 75 state = 0 76 End Select 77 End If 78End Sub 79 80Public Sub Find_OnClick() 81 ’ Validate the input values. Never assume valid 82 ’ data is in the text boxes ’ Server.Value will be used to designate the 85 ’ server with the database 86 If Server.Value = "" Then 87 Call Msgbox( "Please specify a web server. " & _ 88 "Suggest: ) ’ ISBN.Value is the record we want to search for 91 ElseIf ISBN.value = "" Then 92 Call MsgBox( "Please specify an ISBN to examine. " & _ 93 "Suggest: " )

 2000 Deitel & Associates, Inc. All rights reserved. Outline 5.3 Begin data download 5.4 Set values 5.5 Tell server to begin sending data - call deitelDC.Refresh() Sub procedure 5.6 Close structures 6.1 Define Update_ OnClick() Sub procedure 6.2 Fetch value from text box, setup to go back to server ’ All data is probably valid so begin the data download. 96 Else 97 ’ Request the data from. 98 deitelDC.Server = Server.Value ’ Set the SQL query. 101 deitelDC.SQL = "SELECT ISBN, " & _ 102 "Title FROM Titles WHERE ISBN = ’" & ISBN.Value & "’" ’ Set the DSN to fetch the data. 105 deitelDC.Connect = "DSN=Books;" ’ Tell the server to begin sending the data to us. 108 Call deitelDC.Refresh() 109 state = End If 111End Sub Public Sub Update_OnClick() 114 ’ If everything worked above, we can change 115 ’ the record in the database 116 If state = 2 Then 117 ’ We are only updating this field in the database. 118 ’ so we fetch the value from the text box and set it to go 119 ’ back to the server for update 120 deitelDC.Recordset( "Title" ) = FoundTitle.Value 121

 2000 Deitel & Associates, Inc. All rights reserved. Outline 6.3 Save changes and refresh 6.4 Close all structures and tag 7.1 Insert and define META tag 7.2 Insert and define searching INPUT s 7.3 Insert button INPUT: “ Find ” 123 Call deitelDC.SubmitChanges() ’ Refresh after submit operation 126 Call deitelDC.Refresh() 127 End If 128End Sub 129--> RDS Example--Correct titles in a remote database 138Record to Find Server: 142 <INPUT ID= server NAME= server VALUE= " 143 TYPE = "text" SIZE = 60> ISBN: 147 <INPUT ID = ISBN NAME = ISBN VALUE = " " 148 TYPE = "text"> Results 122 ’ Save these changes

 2000 Deitel & Associates, Inc. All rights reserved. Outline 7.4 Insert and define Results INPUT elements 7.5 Insert button INPUT : “ Update Title ” 7.6 Insert StatusText INPUT textbox Found ISBN( readonly ): Found Title: <INPUT TYPE = "button" ID = "Update" NAME = "Update" 166 VALUE = "Update Title"> Status:<INPUT TYPE = "text" ID = "StatusText" NAME = "StatusText" 169 SIZE = 30 READONLY VALUE = "Click Find.">

 2000 Deitel & Associates, Inc. All rights reserved Remote Data Services (RDS) (V) Document Output 1 The page is loaded

 2000 Deitel & Associates, Inc. All rights reserved Remote Data Services (RDS) (VI) Document Output 2 The use has clicked the Find button which results in the Found ISBN and Found Title fields being populated

 2000 Deitel & Associates, Inc. All rights reserved Remote Data Services (RDS) (VII) Document Output 3 User has edited the Found Title field

 2000 Deitel & Associates, Inc. All rights reserved Remote Data Services (RDS) (VIII) Document Output 4 User has clicked Update Title

 2000 Deitel & Associates, Inc. All rights reserved Remote Data Services (RDS) (IX) Document Output 5 User has clicked Find