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.

Slides:



Advertisements
Similar presentations
Basics of Database Programming with VB6
Advertisements

1 Web-Enabled Decision Support Systems Access Introduction: Touring Access Prof. Name Position (123) University Name.
 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)
XP New Perspectives on Microsoft Access 2002 Tutorial 61 Microsoft Access 2002 Tutorial 6 – Creating Custom Reports.
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
Automating Tasks With Macros
The ADO Data Control. Universal Data Access Open Database Connectivity (ODBC) –standard for accessing data in databases OLE-DB –allows access to data.
Using Visual Basic 6.0 to Create Web-Based Database Applications
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.
Using Objects and Properties
Access Tutorial 1 Creating a Database
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab10 Interacting with Data (Database Management)
1 Pertemuan 09 Database Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
Database Programming (using ADO) Universal Data Access – Microsoft strategy for providing access to information across the enterprise. – UDA provides high-performance.
Concepts of Database Management Sixth Edition
WORKING WITH FILES, MENUS AND DATABASES IN VISUAL BASIC BY V. V. SUBRAHMANYAM.
Access Tutorial 10 Automating Tasks with Macros
Tutorial 1 Creating a Database. Objectives Learn basic database concepts and terms Learn basic database concepts and terms Explore the Microsoft Access.
Chapter 8: String Manipulation
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Databases and LINQ Visual Basic 2010 How to Program 1.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
XP New Perspectives on Introducing Microsoft Office XP Tutorial 1 1 Introducing Microsoft Office XP Tutorial 1.
ASP.NET Programming with C# and SQL Server First Edition
Handling of data from multiple databases. Visual Basic Database Visual Basic application acts as a front-end to the database Visual Basic application.
Copyright © 2001 by Wiley. All rights reserved. Chapter 10: Advanced Database Operations Revising Vintage Videos Setting RecordSource at run time DBGrid.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
Concepts of Database Management Seventh Edition
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Using Visual Basic 6.0 to Create Web-Based Database Applications
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 11 Accessing Database.
Microsoft Office Access 2003 Số tiết: 30 tiết lý thuyết 60 tiết thực hành Giáo viên: Từ thị Xuân Hiền.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
Microsoft Access Lesson 1 Lexington Technology Center February 11, 2003 Bob Herring On the Web at
® Microsoft Access 2010 Tutorial 1 Creating a Database.
Copyright © 2001 by Wiley. All rights reserved. Chapter 9: Introduction to Working with Databases in Visual Basic Database Concepts Relational Database.
XP New Perspectives on Integrating Microsoft Office XP Tutorial 2 1 Integrating Microsoft Office XP Tutorial 2 – Integrating Word, Excel, and Access.
1 By: Nour Hilal. Microsoft Access is a database software where data is stored in one or more Tables. A Database is a group of related Tables. Access.
Program Design and Coding
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
Key Applications Module Lesson 21 — Access Essentials
USING XML AS A DATA SOURCE. Data binding is a process by which information in a data source is stored as an object in computer memory. In this presentation,
1 Database Design and Development: A Visual Approach © 2006 Prentice Hall Chapter 8 DATABASE DESIGN AND DEVELOPMENT: A VISUAL APPROACH Chapter 8 Creating.
® Microsoft Office 2013 Access Creating a Database.
Databases,Tables and Forms Access Text by Grauer Chapters 1 & 2.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 10 1 Microsoft Office Access 2003 Tutorial 10 – Automating Tasks With Macros.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
Tutorial 101 Variable Arrays A group of variables that have the same name and data type and are related in some way Can have as many as 60 dimensions.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 25 I’m Suffering from Information Overload.
Chapter 24 I’m Suffering from Information Overload (Access Databases) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
COMPREHENSIVE Access Tutorial 1 Creating a Database.
ACCESS LESSON 1 DATABASE BASICS VOCABULARY. BACKSTAGE VIEW A menu of options and commands that allows you to access various screens to perform common.
1 Access Lesson 1 Understanding Access Fundamentals Microsoft Office 2010 Fundamentals Story / Walls.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
Lecture 4 Manipulating Form Data using methods of Recordset and RecordsetClone in VBA Restrict data with filter 1 Rapid Application Development.
Tutorial 1 Creating a Database
Microsoft Visual Basic 2010: Reloaded Fourth Edition
Developing Forms and Subforms.
Access Creating a Database
Access Creating a Database
Introduction to Database Programs
Unit – V Data Controls.
Presentation transcript:

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 about employees, customers, inventory, and so on

Tutorial 92 Visual Basic and Databases You can use Visual Basic to access databases created by many popular software packages Visual Basic allows a company to use one interface to access all of a company’s data You can use Visual Basic to create a Microsoft Access database because both Visual Basic and Microsoft Access contain the Jet engine

Tutorial 93 Relational Databases A relational database stores data in tables, which are composed of columns and rows Each column in the table represents a field and each row in the table represents a record

Tutorial 94 Field, Record, Table, Relational Database Field – single item of information about a person, place, or thing Record – group of related fields that contain all of the information about a person, place, or thing Table – group of related records; each record contains the same fields Relational database – one or more tables

Tutorial 95 One-table Relational Database

Tutorial 96 Two-table Relational Database The records are related by the CD number

Tutorial 97 Advantages of Relational Databases Provide easy and quick retrieval of information Allow you to display the data in any order Allow you to control how much of the data (which fields and records) are displayed at any one time

Tutorial 98 Five Design Steps Identify the information the user will need from the database Organize the information into one or more tables Establish relationships between tables (if the database contains more than one table) Create one or more indexes, if necessary Define data validation rules, if necessary

Tutorial 99 Index A special table that is created and maintained by Visual Basic Allows you to arrange the records in a specific order, and also quickly search for information Create an index only for fields on which you plan either to order or to search

Tutorial 910 Index For each record, the index stores two fields Index field – stores values contained in the field being indexed Pointer field – stores a number that represents (points to) the location of the record in the table

Tutorial 911 Index and Pointer Fields

Tutorial 912 Data Validation Data validation refers to the process of ensuring that the data in the database meets certain criteria A data validation rule places restrictions on the data entered in a field

Tutorial 913 Summary Chart Table name:tblPatron Field names:fldSeat, fldName, fldPhone Relationships:None Index: Create an index named indSeat for the fldSeat field Validation rule: The fldSeat field must contain a number that is greater than or equal to 1 and less than or equal to 48

Tutorial 914 Visual Data Manager Application that comes with Visual Basic Use to create a Microsoft Access database, including indexes and data validation rules Click Add-Ins on the Visual Basic menu bar, then click Visual Data Manager, and then open a new or existing Microsoft Access 7.0 database

Tutorial 915 Visual Data Manager

Tutorial 916 Table Structure Dialog Box

Tutorial 917 Add Field Dialog Box

Tutorial 918 Fields Shown in the Database Window

Tutorial 919 Add Index Dialog Box

Tutorial 920 Validation Rules

Tutorial 921 Dynaset Window

Tutorial 922 Find Record Dialog Box

Tutorial 923 Like Operator and * Wildcard

Tutorial 924 UDA, OLE DB, ADO UDA – Microsoft’s approach to solving the data access problem OLE DB – provides uniform access to data stored in a variety of formats; Visual Basic programmers gain access to the complex OLE DB interfaces through ADO ADO – allows you to access the OLE DB interfaces

Tutorial 925 ADO Data Control Microsoft’s ADO (ActiveX Data Object) data control can access the data stored in a variety of formats, such as a database, a spreadsheet, or even a text file The ADO data control establishes a link between the database and the other controls in the application’s interface

Tutorial 926 ADO Data Control

Tutorial 927 Provider Tab

Tutorial 928 Connection Tab

Tutorial 929 General Tab

Tutorial 930 RecordSource Tab

Tutorial 931 Binding Controls Connecting a control to an ADO data control is called binding, and the connected controls are referred to as data-aware controls or bound controls Any control that has a DataSource property can be bound to an ADO data control

Tutorial 932 Binding Controls Set the control’s DataSource property to the name of the ADO data control Set the control’s DataField property to the name of a field in the database Always set the DataSource property before setting the DataField property

Tutorial 933 SQL Stands for Structured Query Language A set of commands that allow you to access and manipulate the data stored in many database management systems on computers of all sizes SQL commands can be used to store, retrieve, update, and sequence data

Tutorial 934 SQL Select Statement select fields from table [where condition] [order by field] Fields is one or more field names, separated by commas Table is the name of the table containing the fields Where condition clause allows you to limit the records that appear when displayed Order by field clause allows you to control the order in which the records appear when displayed

Tutorial 935 Select Command Example

Tutorial 936 Select Command Example

Tutorial 937 Where Clause Examples To view seat 24’s record, select * from tblPatron where fldSeat = 24 To view all records, in seat number order, whose seat numbers are greater than 20, select * from tblPatron where fldSeat > 20 order by fldSeat To view Candy Sprott’s record, select * from tblPatron where fldName = “sprott, candy” To view all records whose phone number begins with 333, select * from tblPatron where fldPhone like “333%”

Tutorial 938 RecordSet and Field Objects and the Fields Collection Recordset object - the collection of records selected by the ADO data control’s RecordSource property Each field contained within the Recordset object is referred to as a Field object The collection of Field objects within a Recordset object makes up the Fields collection To refer to a field within the Fields collection: [form.]adocontrol.Recordset.Fields(field)

Tutorial 939 Recordset and Field Objects and the Fields Collection The select * from tblPatron command will create the following Recordset object, Field objects, and Fields collection: Recordset object: All records stored in the tblPatron table Fields collection: fldSeat, fldName, fldPhone 3 Field objects

Tutorial 940 Methods of the Recordset Object AddNewAdd a new, blank record to the end of the recordset CancelUpdateCancel changes made to the current record DeleteDelete the current record from the recordset MoveFirstMove the record pointer to the first record in the recordset MoveNextMove the record pointer to the next record in the recordset UpdateSave the changes made to the current record

Tutorial 941 Recordset Object’s EOF Property EOFTest for the end of the recordset The EOF property contains True if the record pointer is positioned after the last record in the recordset; otherwise, the property contains False

Tutorial 942 Syntax of Recordset Object’s Methods and Properties The syntax for invoking a method of the Recordset object is: [form.]adocontrol.Recordset.method The syntax for referring to a property of the Recordset object is: [form.]adocontrol.Recordset.property.

Tutorial 943 ADO Data Control’s Refresh Method adocontrol.Refresh To create a new Recordset object while an application is running, you need first to enter, into a code window, an instruction that resets the ADO data control’s RecordSource property. You then need to use the ADO data control’s Refresh method to reopen the database and recreate the Recordset object

Tutorial 944 Visible vs Enabled If the application never allows the user to interact with the ADO data control, then you should hide the control If the application allows the user to interact with the ADO data control when a certain condition is met, then you should disable the control and enable it when the condition is met

Tutorial 945 Debugging Technique The Debug menu’s Step Into command allows you to execute the application’s code one statement at a time You also can use the Step Into button on the Debug toolbar to access the Step Into command; or you can press the F8 key on your keyboard