0% found this document useful (0 votes)
113 views10 pages

Linking Database To A VB Project (Lesson 5)

This document provides steps for connecting a Microsoft Access database to a Visual Basic .Net application. It begins with database terminology and types of database products. It then outlines the process in 8 steps: 1) Create an Access database, 2) Create tables and records, 3) Create a VB.Net project, 4) Add data sources to link the database, 5) Drag tables to forms, 6) Test record navigation, 7) Add navigation buttons, and 8) Code the buttons to perform actions like saving, deleting, moving to next/previous records. Code samples are provided for saving data and deleting records.

Uploaded by

Vine Vapour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views10 pages

Linking Database To A VB Project (Lesson 5)

This document provides steps for connecting a Microsoft Access database to a Visual Basic .Net application. It begins with database terminology and types of database products. It then outlines the process in 8 steps: 1) Create an Access database, 2) Create tables and records, 3) Create a VB.Net project, 4) Add data sources to link the database, 5) Drag tables to forms, 6) Test record navigation, 7) Add navigation buttons, and 8) Code the buttons to perform actions like saving, deleting, moving to next/previous records. Code samples are provided for saving data and deleting records.

Uploaded by

Vine Vapour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Linking Database to VB.

Net
Using Microsoft Access Database Product
Terminologies
• Database – a special repository—consists of one or more physical
files—used to store and retrieve data.
• Relational database – a specific type of database where data rows
are stored in separate tables, and the tables are related to each other
by key values.
• Table – basic database object that stores data
• Row = a row is a record representing an individual, course or student.
• Column = a column is a field that stores data.
• Key Column (Field) – uniquely identifies a row in a table
• Relationship- an association between two tables.
Database Products
• Oracle (by Oracle Corporation) and DB2 (by IBM) for large systems—
these are competing relational database management systems.
• Microsoft SQL Server for mid-sized systems and larger scalable
systems.
• Microsoft Access and other small-sized, individual user or small group
systems.
Table Types

• Base table – a base table is one that stores basic information about
entities.
• Association table – an association table stores information about
associations between entities.
• Validation table – a validation table validates data entered into
another table. (use of validation rules)
Process of connecting a database to Visual
Studio
STEP ONE:
Open Access Database and create a new database. Save the database
using (2002-2003) format (.mdb).
STEP TWO:
Create tables and insert a few records. Save and close the database.
STEP THREE:
Open Visual Studio and create a new project.
Add forms based on the tables from database.
Process of connecting a database to Visual
Studio contd,

STEP FOUR:
Add Data sources from the “Data” tab to link to the database.
STEP FIVE:
Drag the tables to their respective forms.
STEP SIX:
Run the system to test for records navigation.
Process of connecting a database to Visual
Studio contd,
STEP SEVEN:
Add Navigation Buttons.
Previous, Save Data, Delete, Add New, Next
STEP EIGHT:
Code the buttons.
Save Data Button
Try
EmployeeTableBindingSource.EndEdit()
TableAdapterManager.UpdateAll(EmployeeDataDataSet)
MsgBox("Success")
Catch ex As Exception
MsgBox("Error! Please recheck fields and try again")
End Try
Delete Button
EmployeeTableBindingSource.RemoveCurrent()
TableAdapterManager.UpdateAll(EmployeeDataDataSet)
MsgBox("Current record deleted successfully")
Coding the buttons
Next Button
Table1BindingSource1.MoveNext()
Previous Button
Table1BindingSource1.MovePrevious()
Add New Button
Table1BindingSource1.AddNew()

You might also like