You are on page 1of 1

La Salette of Roxas College Inc.

Magsaysay St. Vira, Roxas, Isa.


Preliminary Examination AOO Programming
Name:______________________________________

Score:_______________

Student must be
1. Able to create a MS Access Database.
2. Able to establish connection between the database and the VB application or project.
3. Able to display sample records from the database to the listview in the VB
project(Application)
4. REPLACE missing_code WITH THE APPROPRIATE LINE/S OF CODE.
OLEDB Connection Syntax
Try
With (missing_code)
If .State = (missing_code).Closed Then
.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=../(missing_code);"
.Open()
MsgBox("Connected")
End If
End With
Catch ex As Exception
MsgBox(ex.Message)
End Try

Display Record from database using ListView


Public Sub (missing_code)
ListView1.Items.Clear()
missing_code = "SELECT * FROM missing_code "
Dim (missing_code) As (missing_code) = New (missing_code)(missing_code, missing_code)
missing_code = missing_code.ExecuteReader

While missing_code.Read
With ListView1
.Items.Add(missing_code("missing_code "))
With .Items(.Items.Count - 1).SubItems
.Add(missing_code("missing_code"))
End With
End With
End While
End Sub

You might also like