Using Visual Basic 6.0 to Create Web-Based Database Applications

Slides:



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

Tutorial 12: Enhancing Excel with Visual Basic for Applications
The Web Warrior Guide to Web Design Technologies
© by Pearson Education, Inc. All Rights Reserved.
1 Chapter 12 Working With Access 2000 on the Internet.
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
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.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Using Objects and Properties
Using the Visual Basic Editor Visual Basic for Applications 1.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Introduction To Form Builder
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
1 Chapter 1 Tour of Access. 1 Chapter Objectives Start and exit Microsoft Access Open and run an Access application Identify the major elements of the.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Creating a Console Application with Visual Studio
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
INTRODUCTION TO WEB DATABASE PROGRAMMING
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
A First Program Using C#
Introduction to Visual Basic (VB)
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Beyond DHTML So far we have seen and used: CGI programs (using Perl ) and SSI on server side Java Script, VB Script, CSS and DOM on client side. For some.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Microsoft Visual Basic 2005: Reloaded Second Edition
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
Server Side Programming ASP1 Server Side Programming Database Integration (cont.) Internet Systems Design.
Tutorial 11 Using and Writing Visual Basic for Applications Code
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
IE 411/511: Visual Programming for Industrial Applications
Appendices A - F A-F Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Fundamentals of Database Chapter 7 Database Technologies.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
Using Visual Basic for Applications (VBA) – Project 8.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Introduction to the Visual Studio.NET IDE (LAB 1 )
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
CHAPTER TWO INTRODUCTION TO VISUAL BASIC © Prepared By: Razif Razali 1.
Chapter Two Creating a First Project in Visual Basic.
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.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
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.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
ODBC : Open Database Connectivity SNU OOPSLA Lab. October 2005.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Object-Oriented Application Development Using VB.NET 1 Chapter 2 The Visual Studio.NET Development Environment.
Creating New Forms Projects can appear more professional when using different windows for different types of information. Select Add Windows Form from.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
ASP.NET Programming with C# and SQL Server First Edition
Chapter 2: The Visual Studio .NET Development Environment
1. Introduction to Visual Basic
Presentation transcript:

Using Visual Basic 6.0 to Create Web-Based Database Applications Chapter Six Using Visual Basic 6.0 to Create Web-Based Database Applications

Chapter Objectives Learn about the Visual Basic development environment Learn about the components of a Visual Basic database application Create a Visual Basic application using the ADO data control to display database data

Chapter Objectives Create programmatic data controls to process data in a Visual Basic program Create a Visual Basic ActiveX document that is run from a Web page

Figure 6-1: Installing an ActiveX document ActiveX Documents ActiveX documents A program that users can download from a Web site and install on their computers Figure 6-1: Installing an ActiveX document

Overview of Visual Basic Can be used to create almost any kind of Windows-based program An event-driven programming language Program statements execute in response to user actions or to system actions

Components of a Visual Basic Program Project file Specifies properties of the program and the names of the individual component of the program Form Main components of a VB project Composed of the visible interface that the user sees and interacts with, and the associated code that responds to user and system actions

Components of a Visual Basic Program Standard module Contains only code Used to store declarations for variables that are used in multiple forms Procedure Manipulates variable values Function Returns a single value based on parameters that are passed to the function

Components of a Visual Basic Program Controls are the visible items on a form Figure 6-2: Form Controls

Visual Basic Projects When VB is started, a new project is created, which corresponds to an individual user application When you create a new project, you can select the type of project it will be, which specifies how the project file is compiled

Visual Basic Projects Figure 6-3: Visual Basic project types

The Visual Basic Development Environment Integrated development environment (IDE) Environment for developing programs Figure 6-4: VB IDE components

The Visual Basic Development Environment Main IDE components include: The toolbar provides quick access to menu bar commands for opening The Object window shows the form and the position of the controls on the form The toolbox contains icons that are used to create form controls

The Visual Basic Development Environment Main IDE components include (cont.) The Project Explorer displays a hierarchical list of the components of the current project The Properties window is used to assign and display the properties of the object that is currently selected in the Form window Docking Allows the borders of windows to be attached, or docked, to other windows

Creating a Visual Basic Database Application Data control Form control that is attached to a database table Used to sequentially step through the record to view the items

Creating a Visual Basic Database Application Figure 6-8: Clearwater Traders Inventory Maintenance application

Modifying Form Properties The properties of a VB object specify the object’s appearance and behavior Name property Determines how objects are internally identified within the project Must begin with a letter and can contain characters, numbers, or underscores

Modifying Form Properties Table 6-1: VB object name prefixes

Modifying Form Properties To follow accepted Windows application design guidelines, you should always modify the following form properties: Border Style, which determines whether the user can resize the form Caption,which is the form description that is displayed in the form’s title bar MaxButton, which allows the user to maximize the form so that it is displayed full-screen

Modifying Form Properties To follow accepted Windows application design guidelines, you should always modify the following form properties (cont.): MinButton, which allows the user to minimize the form StartUpPosition, which determines where the form is displayed on the screen when the application is running

Saving Visual Basic Projects A VB project is saved in a file with a .vbp extension Forms are saved in files with an .frm extension When you create a new project, it is very important to always save the project (.vbp) file and the form (.frm) file in the same folder in your file system

Using Visual Basic with a Database ODBC driver Low-level program that translates messages from an application into the syntax expected by a specific database Each different type a database requires a different ODBC driver Always runs on the client workstation

Using Visual Basic with a Database Programs written in program development languages and applications that access databases, need to communicate with ODBC drivers To simplify this communication, Microsoft has developed a variety of different data access technologies: Data Access Objects (DAO), Remote Data Objects (RDO), and ActiveX Data Objects (ADO)

Using Visual Basic with a Database DAO Available in most applications that support database connectivity, but cannot support action queries that change content in some databases RDO Full-featured, but only available in Microsoft’s high-end enterprise-level programming environments ADO Full-featured, is available in most Microsoft environments, and supports most types of queries

Using Visual Basic with a Database Figure 6-12: Microsoft data access architecture using ODBC

Using Visual Basic with a Database Figure 6-13: Microsoft data access architecture using ADO and OLE DB

Creating an ActiveX Data Control A control that is displayed on a form Different from an ordinary form control because it is associated with a recordset A specific set of database records based on a SQL query

Creating an ActiveX Data Control Figure 6-14: ActiveX data control

Creating an ActiveX Data Control To create an ADO data control, you must add a type library to your project A type library is a library of code that has programs, such as additional controls, that you can add to VB IDE and then use in your project

Using Program Code to Process Data With a programmatic data connection: All of the commands to create the connections and execute SQL commands are specified in a VB standard module User does not have to interact with a visible data control to perform database operations

Variables in Visual Basic Programs Visual Basic code has variables and data types just like other programming languages It is a good programming practice to always declare variables before using them VB does not require you to declare variables, but allows you to assign a value to a variable without declaring it first. This can lead to errors StudentAge = 22 StudentAge = StdentAge + 1 Option Explicit

Variables in Visual Basic Programs Declaration keyword that is used to declare a variable depends on the desired scope of the variable Scope Specifies how long the variable exists in memory Specifies what program components can assign and access the variable value Public, Private, Dim, Static

Variables in Visual Basic Programs Variable declaration keywords are used as follows: The Public keyword is used to declare global variables These are variables that are visible to all forms and modules within a project

Variables in Visual Basic Programs Variable declaration keywords are used as follows (cont.): The Private keyword is used to declare form-level and standard module-level variables These are variables that are visible only to procedures and functions written within the form or standard module where the variable is declared

Variables in Visual Basic Programs Variable declaration keywords are used as follows (cont.): The Dim keyword is used to declare local variables These are variables that are visible in the function or procedure where they are declared

Variables in Visual Basic Programs Variable declaration keywords are used as follows (cont.): The Static keyword is used to declare local variables whose values are only visible within the procedure where they are declared, but whose values still exist and can be accessed after the procedure is exited

Variables in Visual Basic Programs The Variant data type can store any type of data Table 6-2: Visual Basic data types

Visual Basic Objects and Collections In object-oriented programming languages, an object is an item that has a specific structure and behavior (forms, controls) Methods (objects have associated methods) Procedures that perform an operation on an object Collection (forms collection contains all forms in a VB application) Contains a set of related objects

Running Programs in the Visual Basic IDE Source code The program code that you write Interpreted Means that the code is translated to machine language and executed one line at a time Compiled Means that all of the code is translated into machine language, and the machine-language version is then stored as an executable file

Message Boxes A message box provides information to user regarding status of program or current operation Figure 6-23: Message box

Using a DataGrid Control Figure 6-29: Inventory form

Displaying Visual Basic Programs Using Web Pages Visual Basic projects can be created to make standard executable files Also can be created using different ActiveX options to make programs that can be installed and/or run by clicking a hyperlink on a Web page

ActiveX Options Supported by Visual Basic Active documents Have both a visual interface and code to process user inputs and actions Active programs Provide processing for other Web programs, but do not have a visual interface component Active controls Used to create custom controls that can be used in other Web-based programming projects

Creating an ActiveX Document User document Container object in an ActiveX document Similar to a form in the sense that it can contain controls and code, and has events similar to those in a form A user document must be associated with, or sited on, an external application, which is called a container

Displaying an ActiveX Document using a Hyperlink When creating a Internet package using Package and Development Wizard, the Wizard creates an HTML file containing the command for the hyperlink that references the ActiveX document Figure 6-34: Link to ActiveX document file in HTML file created by Package and Development Wizard