100 likes | 199 Vues
IS437: Spring 2006 Instructor: Dr. Boris Jukic. Interacting with a Database: ADO.Net. Introduction to ADO.Net. The basic ActiveX Data Objects model Creates a connection to the database Binds data to controls. Connecting the Database with the Client Application. database. Project.
E N D
IS437: Spring 2006Instructor: Dr. Boris Jukic Interacting with a Database: ADO.Net
Introduction to ADO.Net The basic ActiveX Data Objects model Creates a connection to the database Binds data to controls
Connecting the Database with the Client Application database Project invoice Form1 Form2 … customer invoice line item part … Provided by Access, or Oracle, etc.
dataset customer ADO.Net: A Disconnected Model Project database Form1 Form2 … invoice customer invoice line item part … resides in the local machine Provided and Managed by Access, or Oracle, etc.
dataset invoice customer customer invoice line item part … How to create a dataset database 3 SQL Adapter 1 Microsoft Access Provider Connection Microsoft Jet 4.0 OLE DB Provider 2
How to create a dataset • Step 1: select a provider, a database to connect to, and specific table from the database to work with. Drag the chosen table onto the form and an instance of OleDbDataAdaper (OleDbDataAdapter1 by default) is placed in the data tray. • Step 2: From the Data menu, select “Generate the dataset…
How to create a dataset: Step 2 At the completion of Step 2, a dataset (dataset11 by default) is placed in the component tray.
How to create a dataset • Step 3: Fill the dataset with data. Place the following code in the form load event. OleDbAdapter1.Fill(Dataset11) OldDbAdapter1 is the name of the adapter, Dataset11, the name of the dataset.
dataset customer Project database Form1 Form2 … invoice customer invoice line item part … resides in local machine Managed by Access, or Oracle, etc.