Professional Documents
Culture Documents
ANDHRA PRADESH
Name : Y. Vijaya Bhaskara Reddy
Designation : Senior Lecturer
Branch : Commercial and Computer
Practice
Institute : G.P.W ., Kakinada
Year/Semester : VI Semester
Subject : Visual Basic – II
Subject Code : CCP – 603
Topic : Database Programming
Duration : 50 Mts
Sub Topic : Data Control’s methods
Teaching Aids : PPTs
CCP603.17 1
Objective :
CCP603.17 2
Structure Of The Period :
CCP603.17 3
Recap :
Data Control is used to connect database
tables to the form in Visual Basic
By setting the Database Name and Record
Source properties of data control, tables
are connected
To display the data, text boxes are used
Data Source and Data Field properties of
text box are used for this purpose
CCP603.17 4
Connecting a Table Using Data
Control :
Press Ctrl+N in Visual Basic to start a new
project
From the New Project dialog box, select
Standard EXE and Click OK
Add two text boxes to the top of a form
Double-click the data control in the Tool Box
to add it to the form
Drag the newly added data control to position
it below the Text boxes
CCP603.17 5
Connecting a Table Using Data
Control : (Contd..)
Set the properties of the data control as follows:
CCP603.17 7
Data Control’s Navigation Methods :
CCP603.17 8
Data Control’s Methods :
To implement these methods, command buttons
are used
Add four command buttons to the button of the
form
Set their ‘caption’ properties to MoveFirst,
MoveLast, MoveNext and MovePrevious
respectively
Set the ‘visible’ property of data control to ‘false’
Then the form looks as follows:
CCP603.17 9
Form Design View
CCP603.17 10
Now double click on the MoveFirst command
button and enter the following code in the code
window
Data1.Recordset.MoveFirst
CCP603.17 11
Record Manipulation methods
• The record manipulation operations and the methods to
carry them out are
Addnew– for adding records
Update – for saving
Delete - for deleting records.
CancelUpdate – for cancelling records
• These methods are used with Data controls as follows:
Data1.Recordset.Addnew etc.
• The above code can be attached to buttons and used
as needed just like with navigation methods
CCP603.17 12
Code Window
CCP603.17 13
Run the program and scroll through the
records with the navigation buttons on the
data control
CCP603.17 14
Summary :
Data Control has four important methods
for record navigation
Using these methods, records can be
browsed one by one
CCP603.17 15
Quiz :
CCP603.17 16
Frequently Asked Questions :
CCP603.17 17
Assignment :
CCP603.17 18
Thank You
CCP603.17 19