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

Using Macros and Visual Basic for Applications (VBA) with Excel
Tutorial 12: Enhancing Excel with Visual Basic for Applications
The Web Warrior Guide to Web Design Technologies
© by Pearson Education, Inc. All Rights Reserved.
Chapter 6 Multiform Projects Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
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
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
A Guide to Oracle9i1 Creating an Integrated Database Application Chapter 8.
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.
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.
Saving and Loading Simple Text Files A sequential file stores characters one after the other like songs on a cassette tape. New characters are added to.
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#
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
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.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
Tutorial 11 Using and Writing Visual Basic for Applications Code
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Using Visual Basic 6.0 to Create Web-Based Database Applications
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.
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.
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.
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.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Multiform Projects.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
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.
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.
Object-Oriented Application Development Using VB.NET 1 Chapter 2 The Visual Studio.NET Development Environment.
Chapter 27 Getting “Web-ified” (Web Applications) Clearly Visual Basic: Programming with Visual Basic nd Edition.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
Creating New Forms Projects can appear more professional when using different windows for different types of information. Select Add Windows Form from.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
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.
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

Using Program Code to Process Data Figure 6-17: Creating a data connection programmatically

Code in Visual Basic Programs A VB project consists of forms and standard code modules Every form and every code module has a section called the General Declarations section Contains declarations for variables, and the code for functions and procedures that are used in the form or code module

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

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

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 Methods Procedures that perform an operation on an object Collection 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

Table 6-3: Message box return values Message Boxes A return value is an integer value that corresponds to the button the user clicks in the response to the message box A prompt is a text string that specifies the message displayed in the message box Table 6-3: Message box return values

Message Boxes Buttons Defines the buttons that are displayed in the message box Commonly used values include: vbOKOnly vbOKCancel vbYesNo vbYesNoCancel

Message Boxes Title is a text string that defines the text that is displayed in the message box title bar Table 6-4: Predefined message box definitions

Using a DataGrid Control To display database records on a Visual Basic form, you use a DataGrid Always associated with an ADO control, which specifies the database connection and the SQL query that returns the records that are displayed in the grid

Using a DataGrid Control Figure 6-29: Inventory form

Displaying and Hiding Forms in a Project In Visual Basic, a form can be displayed as modal or modeless Modeless User can interact with other project forms while the form is displayed Modal User can interact with only the modal form, and cannot interact with any other project forms until the modal form is unloaded

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

Creating an Installation Package for Your ActiveX Document Installation package - has the files needed to install an application on a user’s workstation Visual Basic provides a program called the Package and Development Wizard that leads developers through the steps needed to create an installation package

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

ActiveX Documents and Security Considerations One approach to controlling and screening ActiveX programs is the use of verification certificates These certify that software is from a trustworthy source With verification certificates, users can be confident that the certified software will not harm their workstations

Chapter Summary Visual Basic is a development language and used to create Windows-based applications A VB project can have forms and code modules Visual Basic has an integrated development environment (IDE) with multiple windows for displaying and modifying project components Visual Basic forms and controls have properties, which determine how the forms and controls look and function

Chapter Summary An Open Database Connectivity (ODBC) driver is a program that allows an application to interact with a database A DataGrid is used to display multiple database records in a matrix format You can create a VB project that is an ActiveX document, which has both visual components and code, and can be displayed as a Web page using the Microsoft Internet Explorer browser