Académique Documents
Professionnel Documents
Culture Documents
0
Update Edition
Chapter 11
Database Terminology
Databases
Tables
Records
Fields
Primary Key
Foreign Key
Relationships
Relational Databases
Database includes
Tables - collection of related data
Queries - SQL designed to select data from tables
Table
Record - row of related data for one instance
Field - column of specific data element
Keys
Primary - uniquely identifies a record
Foreign - links record to related record in related table
ADO
Connection String
OLE DB Provider (ex: Jet 3.5.1 or Jet 4.0) (p 99)
Database path and filename
Optional userid and password
RecordSource
Name of Table, Stored Procedure, or SQL statement
Command type (ex: adCmdTable, adCmdStoredProc,
adCmdText)
Access Permissions (ex: read, readwrite)
Intrinsic controls
DataSource ===> ADODC
DataField ===> field in source
Recordset
adoBooks.Recordset.MoveFirst
adoBooks.Recordset.MoveLast
adoBooks.Recordset.MoveNext
adoBooks.Recordset.MovePrevious
adoBooks.Recordset.EOF
adoBooks.Recordset.BOF
Modifying Records
ADODC
Set EOFAction property to adDoAddNew in
Properties Window
At EOF, when user clicks next record
VB automatically begins Add operation
VB clears bound controls
When user clicks arrow button, the Update
method is automatically executed and the new
record is written to the file
Deleting Records
With adoBooks.Recordset
.Delete
.MoveNext
End With
Delete Considerations
With adoBooks.Recordset
.Delete
.MoveNext
If .EOF Then
.MovePrevious
If .BOF Then
MsgBox "The recordset is empty"
End If
End If
End With
adoBooks.ConnectionString=
"Provider=Microsoft.Jet.OLEDB.3.51;
Persist Security Info=False;
Data Source=" & App.Path & "\Biblio.mdb;
Mode=Read"
adoBooks.Refresh
adoBooks.Recordset.Close