Title: ECommerce Infrastructure
1E-CommerceInfrastructure Security
- Lecture 11
- VB and DB(DDWS 51-84 165-214)
2Agenda
- Install VB 6.0
- DB Basics - Review
- Creating a DB-enabled Visual Basic
ActiveX-driven web site
3Our Goal - An ActiveX DB Control
- Recall our previous discussion of ActiveX
- Wed like to add DB capability to our Web site
4Installing VB 6.0
- Grab a CD-Rom shove it in
- Follow the on-screen commands
- Key 325-1328043
- Select VB Professional
- TYPICAL install is fine
- Reboot w/ disc in drive
- No need for server tools
- Uncheck MSDN registration
5Database Review
- Im assuming Chapter 3 was review for you
- Youve taken ITSK1701(DB Applications - Access)
- Very Briefly
6Structured Query Language (SQL)
- Standard query language of relational databases
- Desirable to use as query language to communicate
between the Web pages and the database - Easier to migrate Web page applications to other
database platforms - Structure and syntax of SQL is the same across
most database management systems (DBMSs)
7MS Access Components
- Access application environment
- User interface used to create tables, manage
data, and create and manage database objects - Jet database engine
- Underlying DBMS that manages database tables and
processes SQL commands
8ODBC
- Open Database Connectivity
- Standard database communication protocol
- Enables a database application to interact with
different DBMSs
9An Overview
10Database Queries
- Question that can be answered by data stored in a
database - Retrieve data from single or related data from
multiple database tables - Perform mathematical functions on retrieved data
- Group retrieved records and perform group
functions
11Various Means of Defining Queries
- Query by example (QBE)
- Technique used in Access to create queries
- Jet SQL
- Commands unique for the SQL syntax used by the
Jet database engine
12Views in Access
- Design View used to create QBE queries
- SQL View used to view the SQL text associated
with QBE queries and to enter SQL queries
directly - Datasheet View used to view query results
13Making Use of SQL
- Were going to use VB
- Well create an application
- Then well interface w/ a DB
- And convert the application into an ActiveX
control
14OK - Now to Visual Basic
- Object-oriented programming language
- Event driven
- Project file - the master document
- Form - interface responsive code
- Module - defines commonly-used code in the way of
procedures functions
15Visual 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
16Visual Basic Projects
17The VB IDE
18Saving 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
19Using 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
20Using Visual Basic with a Database
- Need to communicate with ODBC drivers
- Microsoft has developed a variety
- Data Access Objects (DAO)
- Remote Data Objects (RDO)
- ActiveX Data Objects (ADO)
21Using 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 Microsofts
high-end enterprise-level programming
environments - ADO
- Full-featured, is available in most Microsoft
environments, and supports most types of queries
22Using Visual Basic with a Database
23Using Visual Basic with a Database
24Creating an ActiveX Data Control
- 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
25Creating an ActiveX Data Control
26Creating 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
27Using 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
28Using Code to Process Data
29A Simple DB Application
30Putting A Project Together
- Start up a Standard EXE
- Drop down 3 text boxes
- Add the ADO Control
- Right click Control View
- Select MS ADO Data Control 6.0
- Have it point to the clearwater DB
- Set the RecordSource SQL toSELECT FROM item
- Set the DataSource and DataField properties for
each of the three text boxes
31Making the ActiveX Document
- Wed like to be able to pull this application
into the browser - Well make a new ActiveX Document project
- Itll make use of the project we just made
32Creating the ActiveX Document
- Create new ActiveX Document project
- Project Add Form Existing browse to the
form1 - Well need to make this form open by default, so
edit the Initialize method of the ActiveX
Document form1.show 1
33Creating the Executable
- We need to create the executable and the display
file for our ActiveX Document - File Make PROJECTNAME.exe
- Select location
- Exit VB
- Open IE and browse to the VBD file
- (note, you might have to tell your OS what
program to use to run the VBD file - use
iexplorer
34Packaging
- Wed like to take it all a bit further
- The VB Install Package Wizard will determine
dependencies, etc. so that the application can be
distributed - We wont get into the gory details here, but be
aware that there are dependencies and registry
entries that you need to be aware of.
35Thinking Ahead
- Well go into more detail on developing
DB-enabled Web sites, especially for project 8 - For now, you should be able to follow tonights
lecture and the content of Chapter 6 - coding in
VB and publishing data (via ActiveX Documents) to
the web - Next week - Load balancing (get a handout),
Review Midterm 1 (Infrastructure)
36Have a Great Weekend
FIN