1 / 12

Database Access API’s

Database Access API’s. Aleksandar Stanimirovi ć Leonid Stoimenov Aleksandar Milosavljevi ć. 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

Download Presentation

Database Access API’s

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Database Access API’s Aleksandar Stanimirović Leonid Stoimenov Aleksandar Milosavljević Faculty of Electronic Engineering

  2. 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 Faculty of Electronic Engineering

  3. ADO • Stands for ActiveX Data Objects • Part of Universal Data Access architecture • ADO object hierarchy • Programming with ADO Faculty of Electronic Engineering

  4. Visual Basic integrated environment Object viewer Toolbox Coding window Property window Form designer Faculty of Electronic Engineering

  5. ADO support in VB • Programming with automated data binding tools • Programming with ADO objects in VB code Faculty of Electronic Engineering

  6. User must add ADO support ADO support added by default Adding ADO support in VB Faculty of Electronic Engineering

  7. Programming with automated data binding tools • Data aware controls • ADO Data Control • Data Environment Designer Faculty of Electronic Engineering

  8. Data aware controls • Almost all VB controls are data aware: • Four properties for binding with data source: • Data source • Data member • Data field • Data format Faculty of Electronic Engineering

  9. ADO Data Control Faculty of Electronic Engineering

  10. Data Environment Designer Faculty of Electronic Engineering

  11. 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 Faculty of Electronic Engineering

  12. Exercise • Create Data project in VB • Using existing form in project show data from specified table in database • Place ADO Data control on form • Link ADO Data control with existing exercise database on Oracle or MS SQL Server • Place controls on form and link them with ADO Data control • Add new form in project and show data based on previous exercise query. • Using Data environment create connection to existing database on Oracle or SQL Server • Create Command object that executes specified SQL query. • Place on database fields from Data environment. • Add code that scroll database data. Faculty of Electronic Engineering

More Related