Download PPT Presentation

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Database Access API’s
Aleksandar Stanimirović
Leonid Stoimenov
Aleksandar Milosavljević
1
Faculty of Electronic Engineering
Exercise goals
Get familiar with connecting to different
data sources through ADO
 Get know the basic of ADO object model
 Get familiar with using VB as rapid
application development tool
 Get familiar with using ADO in VB

2
Faculty of Electronic Engineering
ADO




Stands for ActiveX Data Objects
Part of Universal Data Access architecture
ADO object hierarchy
Programming with ADO
3
Faculty of Electronic Engineering
Visual Basic
integrated environment
Toolbox
Coding
window
Property
window
Object
viewer
Form
designer
4
Faculty of Electronic Engineering
ADO support in VB
Programming with automated data binding
tools
 Programming with ADO objects in VB
code

5
Faculty of Electronic Engineering
Adding ADO support in VB
User must
add ADO
support
ADO support
added by
default
6
Faculty of Electronic Engineering
Programming with automated
data binding tools
Data aware controls
 ADO Data Control
 Data Environment Designer

7
Faculty of Electronic Engineering
Data aware controls


Almost all VB controls
are data aware:
Four properties for
binding with data source:
1.
2.
3.
4.
Data source
Data member
Data field
Data format
8
Faculty of Electronic Engineering
ADO Data Control
9
Faculty of Electronic Engineering
Data Environment Designer
10
Faculty of Electronic Engineering
Programming with ADO objects
in VB
Set cnNWind = New ADODB.Connection
Set rsEmployees = New ADODB.Recordset
Dim sConnect As String
sConnect = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source= NWind.mdb”
cnNWind.Open sConnect
rsEmployees.Open “Select * From Employees Order By LastName,FirstName”,
cnNWind
Do While Nor rsEmployees.EOF
Debug.Print rsEmployees!FirstName + rsEmployees!LastName
Loop
rsEmployees.Close
cnNWind.Close
11
Faculty of Electronic Engineering
Exercise
1.
3.
2.
Create
Add new
Data
form
project
in project
in VBand show data
based on
previous
exercise
query.
Using
existing
form
in project
show data

Using
Data environment
create connection to
from
specified
table in database






existing database on Oracle or SQL Server
Place ADO Data control on form
Create Command object that executes specified
Link ADO Data control with existing exercise
SQL query.
database on Oracle or MS SQL Server
Place on database fields from Data environment.
Place controls on form and link them with ADO
Add code
that scroll database data.
Data
control
12
Faculty of Electronic Engineering
Related documents