15
AVCE ICT – Unit 7 - Programming Session 16 – Database and VB

AVCE ICT – Unit 7 - Programming

Embed Size (px)

DESCRIPTION

AVCE ICT – Unit 7 - Programming. Session 16 – Database and VB. In the real world. This is what VB is most used for The user is hidden from the complexities of the database There is a user friendly front end You have the full power of a programming language to manipulate data - PowerPoint PPT Presentation

Citation preview

Page 1: AVCE ICT – Unit 7 - Programming

AVCE ICT –Unit 7 - Programming

Session 16 – Database and VB

Page 2: AVCE ICT – Unit 7 - Programming

In the real world

This is what VB is most used forThe user is hidden from the complexities of the databaseThere is a user friendly front endYou have the full power of a programming language to manipulate dataThe user doesn’t need to have MS Access installed on their machine

Page 3: AVCE ICT – Unit 7 - Programming

Databound controls

These are the ones that can be bound to a database DAO (the data aware objects

databound control) This is used to bind to Access 97

databases ADODC (ActiveX Data Objects Data

Control) This is used to bind to Access 2000

format databases

Page 4: AVCE ICT – Unit 7 - Programming

Data aware controls

These can be associated with a databound control and can be used to display data items Text boxes Labels List and combo boxes Data grid MS Flexgrid plus others

Page 5: AVCE ICT – Unit 7 - Programming

Binding

For the DAO data control, set the Database Name property and then the Record Source property to the table nameFor the ADO, use an ODBC Data Source Name (DSN) which is very simple to set up

Page 6: AVCE ICT – Unit 7 - Programming

Binding - DAOClick on the option list to

select the database

The Jet Engine is the standard MS engine for searching the

database

Page 7: AVCE ICT – Unit 7 - Programming

Binding - DAO

This is the table name but it could be a Query that you have created

in Access

Page 8: AVCE ICT – Unit 7 - Programming

Binding - ADO

The Connection String property specifies

the database

Page 9: AVCE ICT – Unit 7 - Programming

Setting up the DSN

Select 32bit ODBC data

sources from

within control panel

Page 10: AVCE ICT – Unit 7 - Programming

Setting up the DSN Select Add and then select the Microsoft

Access Driver

followed by Finish

Page 11: AVCE ICT – Unit 7 - Programming

Setting up the DSN

Select the Database and then choose a suitable Data

Source Name,

then click OK

Page 12: AVCE ICT – Unit 7 - Programming

Design time coding

Once you have created the DSN and used that to set the Connection String property of the ADODC, you can use tools such as the Data Form Wizard (on the Add Form choices) to create a form containing all of the controls needed to access data

Page 13: AVCE ICT – Unit 7 - Programming

Queries

A query can be used as a DSN in its own rightYou can also create and run queries within VB at run timeDatabases are manipulated using the very high level language called Structured Query Language or SQL (sometimes pronounced Sequel)

Page 14: AVCE ICT – Unit 7 - Programming

Assignment task

A database isn’t necessary for the project but You could create a database to hold

user ID, number pairs The database could be queried to

authenticate the user This would be a very impressive

addition!

Page 15: AVCE ICT – Unit 7 - Programming

Return to Main Menu