Week 6 ADO.Net and Database Access

Week 6 ADO.Net and Database Access - Oledbconnection cn...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
The ADO.Net Object Model Connection Command DataAdapter User-Interface Control which Displays Data DataSet User-Interface Control which displays the result set Oledbconnection cn OledbCommand cm OledbDataAdapter da Dataset ds String Result Set the connection object’s connection string Associate the command with the connection Set the commandtext property of the command object Associate the dataadapter with the command Fill the DataSet with Data If the dataset is empty Result= “Customer Not Found” else Assign phone number to result variable end if Stop Start Declare Variables String Result If textbox is empty Display Error Message else DataServices objDs Get CustLastName Result= objDs.GetPhone() Display Result end if Stop Reading on Data Service Classes in Visual Basic Introduction Data Services classes represent the last tier we need to understand to create a multi-tier application.   In  Visual Basic, the ADO.net object model is used to partially automate the process of interacting with a  database. As stated in the lecture, the ADO.net object model contains several objects – a connection, command,  and data adapter object.   These objects also interact with a dataset object which holds information  supplied by the underlying database.     This data set object connects to a user-interface control which  displays the contents of the data set to the user. 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
As you can see from the diagram, the user interface control connects to the dataset, which is filled by the  dataadapter.  The dataadapter is associated with a command object which contains an SQL command.  The command object is associated with a connection object which specifies the provider to user, the  location of the database, as well as its name. Understanding Providers A provider is software that allows the ADO.net objects to communicate with a specific type of database.  Each version of a database management system is typically associated with a provider that allows  ADO.net interface with it.   In this course, we are interacting with an Access 2007 database, and therefore,  use the Microsoft.ACE.OLEDB.12.0 provider.     Access 2003 databases require you to use the  Microsoft.Jet.OLEDB.4.0   provider. Just as each version of Microsoft Access has its own providers, so do other database management  systems, such as Oracle, MYSQL, and SQL Server. The System.Data.Oledb Namespace Groups of objects are often stored in a common library called a namespace.   The ADO.net library is  found in the System.Data.Oledb namespace.  To make these objects accessible to your DataServices  class, you must place this statement at the top of your class: Imports System.Data.Oledb When these objects have been made available to your Visual Basic program, you can declare and 
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/27/2009 for the course BIS 311 taught by Professor Marshburn during the Fall '08 term at DeVry Cincinnati.

Page1 / 12

Week 6 ADO.Net and Database Access - Oledbconnection cn...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online