pemrograman komputer 9 (database)

15

Click here to load reader

Upload: jayamartha

Post on 04-Jul-2015

461 views

Category:

Education


1 download

DESCRIPTION

unj fmipa-fisika

TRANSCRIPT

Page 1: Pemrograman komputer  9 (database)

Universitas Negeri Jakarta

P e m r o g r a m a n K o m p u t e rP e r t e m u a n 0 9D a t a b a s e

Bambang Heru Iswanto, Dr.rer.nat M.Si

Jurusan FisikaFakultas Matematika dan Ilmu Pengetahuan Alam

101/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 2: Pemrograman komputer  9 (database)

L e a r n in g O u t c o m e s

Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : Menerapkan penggunaan database dalam

aplikasi

201/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 3: Pemrograman komputer  9 (database)

O u t l in e M a t e r ia l

Introduction to Database Stored and Index Ordering Using ADO with Visual Basic Dataset Datagrid Common Programming Errors and Problem

301/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 4: Pemrograman komputer  9 (database)

In t r o d u c t io n t o D a t a b a s e s

Database: any collection of related data used by an organization

Organization: any self-contained social unit such as a company, university, hospital, or family

The data in a database consist of two types:• Entities• Relationships

Relational database: a database in which data is stored in tables

401/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 5: Pemrograman komputer  9 (database)

In t r o d u c t io n t o D a t a b a s e

Record: a row in a table Field name: the heading of a column in a table Entity-relationship diagrams (ERDs) express the

relationships between entities Cardinality of a relationship refers to the number

of one entity that is related to another entity

501/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 6: Pemrograman komputer  9 (database)

In t r o d u c t io n t o D a t a b a s e

6

ERD Symbols

Related to Exactly One

Related to One or More

Related to Zero or One

Related to Zero or More

01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 7: Pemrograman komputer  9 (database)

In t r o d u c t io n t o D a t a b a s e

7

Example of ER Diagram

Departemen KaryawanManajer

KendaraanOperasional

01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 8: Pemrograman komputer  9 (database)

S t o r e d a n d In d e x O r d e r in g

Stored order• A table’s original order• Determined by the order in which records have been

added to the table

Index: a separate table of record positions, called pointers, which lists the positions of the table’s records in the desired order

Key field: the field on which a table’s records are ordered

801/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 9: Pemrograman komputer  9 (database)

U s in g A D O w it h V is u a l B a s ic

ADO is an extremely powerful data access component that allow you to access database data in many formats

Using databases in Visual Basic• Create a link or connection between the database,

known as the data source, and the Visual Basic application

• Retrieve fields from tables in the database and display them on a Form

• Store values on the Form in the database

901/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 10: Pemrograman komputer  9 (database)

U s in g A D O w it h V is u a l B a s ic

To use a database, an application must:• Set up a connection to a data source• Create a data adapter to handle the transfer of data

to and from the data source and the application• Create a dataset to hold the data in memory while

the application works with it• Add controls to the form and set their properties to

bind the controls to the fields in the dataset

1001/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 11: Pemrograman komputer  9 (database)

U s in g A D O w it h V is u a l B a s ic

11

Setting up Data Access in Visual Basic

DataSource

DataAdapter

DatasetWindows

Form

Connection

01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 12: Pemrograman komputer  9 (database)

S e t t in g U p a D a t a C o n n e c t io n

Any database that is ODBC (Open DataBase Connectivity) compliant can be accessed from within Visual Basic

Visual Basic provides a set of Data controls in the Toolbox that are used to set up database access

To establish a connection to an Access database:• Select the OleDbConnection object• Drag an OleDbConnection control from the Toolbox to

the Form

1201/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 13: Pemrograman komputer  9 (database)

S e t t in g u p a D a t a A d a p t e r

The data adapter passes data back and forth between a data source and a program

Use the OleDbDataAdapter control for a Microsoft Access database

Data Adapter Configuration Wizard simplifies the task of using a database table

1301/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 14: Pemrograman komputer  9 (database)

S e t t in g u p a D a t a A d a p t e r

14

First Screen of the Data Adapter Configuration Wizard

01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

Page 15: Pemrograman komputer  9 (database)

T E R IM A K A S IH

01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id | 15