ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.

Slides:



Advertisements
Similar presentations
Data Base. Objective Become familiar with database terminology. Create a project to display data for a single database table. Use a DataGrid control.
Advertisements

1.NET Web Forms DataGrid © 2002 by Jerry Post. 2 Data Grid Has Many Uses  The grid uses HTML tables to display multiple rows of data. It is flexible.
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Chapter 18 - Data sources and datasets 1 Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
VB.NET Database Access ISYS546. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Visual Studio 2005 Using the DataGridView Control V. Matos Cleveland State University.
VB.NET Database Tools ISYS Net Applications OLE DB Provider OLE DB Data Source OLE DB Provider ODBC Data Source SQL Server Data Source SQL Server.Net.
Introduction to Data Adapter. A Simplified View of ADO.Net Objects Ado.Net Data Provider Connection Adapter Command Reader Dataset Data Consumer WinForm.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
VB.NET Database Access ISYS 812. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
VB.NET Database Tools ISYS 573. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
1 Pertemuan 09 Database Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
EGR 141 Computer Problem Solving in Engineering and Computer Science Interfacing with a Database in Visual Basic.NET 2005.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
VB.NET Database Access ISYS546. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS546.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Introduction to ADO.Net and Visual Studio Database Tools
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
VB.NET Database Access ISYS546. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
Some Basic Database Terminology
9-1 Chapter 9 Working with Databases in VB.NET. 9-2 Learning Objectives Understand how databases are used to store business data and how they differ from.
Databases and LINQ Visual Basic 2010 How to Program 1.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Chapter 11 Introduction to Database Processing. Class 11: Database Processing Use a Visual Studio Wizard to establish a database connection used to load.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
1 Databound Controls. 2 Objectives You will be able to use design time data binding to display and update SQL Server database data without writing any.
Needs for Accessing Database To make your web site more dynamic and maintainable, you can display information on your web pages that are retrieved from.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Thirteen Working with Access Databases and LINQ.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with Disconnected Data The DataSet and SqlDataAdapter ADO.NET - Lesson.
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
Module 7: Accessing Data by Using ADO.NET
Using Adapter Wizard ISYS 512. Data Adapter Wizard – 2 nd Level of Using ADO.Net Configure Data Adapter and generating a dataset: –From the Data tab of.
ADO.NET Objects – Data Providers Dr. Ron Eaglin. Requirements Visual Studio 2005 Microsoft SQL Server 2000 or 2005 –Adventure Works Database Installed.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
Databases with LINQ. LINQ to SQL LINQ to SQL uses LINQ syntax to query databases. LINQ to SQL classes are automatically generated by the IDE’s LINQ to.
1 Chapter 20 – Data sources and datasets Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Mauricio Featherman, Ph.D. Washington St. University
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
Databases and ADO.NET Programming Right from the Start with Visual Basic.NET 1/e 11.
Module 3: Working with Local Data. Overview Using DataSets Using XML Using SQL Server CE.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 25 I’m Suffering from Information Overload.
1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Editing and Designing Databases.
Chapter 24 I’m Suffering from Information Overload (Access Databases) Clearly Visual Basic: Programming with Visual Basic nd Edition.
HNDIT Rapid Application Development
1 Database Programming with ADO.NET Kashef Mughal.
Using ADO.Net to Build a Login System Dr. Ron Eaglin.
The Windows Forms DataGrid A Complex-Bound.NET GUI Control Mike FITZSIMON SYSTEMSARCHITECT F ITZSIMON IT C ONSULTING PTY LTD.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 350.
Creating SQL Database file And Displaying a Database Table in a DataGridView.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#
Basic Database Concepts
ADO.NET Accessing Databases in VS.NET
Introduction to VB programming
test slide
VB.NET Using Database.
1.الدوال Function 2.الاجراءاتSub Procedure 3.وحده نمطيه Add Module
ASP.NET Relationships between tables
Chapter 10 Accessing Database Files
CIS 338: Images on Forms Dr. Ralph D. Westfall May, 2009.
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

ADO.NET Objects Data Adapters Dr. Ron Eaglin

Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation of working with Database Command objects Working with Data Adapters Working with Data Sets

Data Adapter Data Adapter is the glue between the database and a dataset.

Data Adapter Data Adapters encapsulate code and functionality to –Select –Update –Insert –delete.

Design Time Data Adapter If SQLDataAdapter is not in your toolbox, add it by using “Choose items …” Drag the SQLDataAdapter onto your form.

Design Time Data Adapter

We will have the adapter Wizard generate stored Procedures.

Design Time Data Adapter

Name the stored procedures to fit The naming convention that you are Using in your database You may review the SQL script that Will be executed to create the stored Procedures.

Design Time DataAdapter This SQL Script will be run to create the Stored procedures used by the data Adapter.

Design Time Data Adapters

SQL Server Note the additional stored Procedures are now added to The list of stored procedures In the database.

SQLDataAdapter properties Note that the Data Adapter also created four command objects

Create the Dataset A Dataset is now necessary to handle the actual data. A Dataset is an in-memory object that “mirrors” the database. A dataset can contain tables, columns, fields.

Create the Dataset The Dataset can also be generated by A wizard. Click on Generate Dataset when The Data Adapter is selected in the form.

Created Dataset The Dataset now exists in the project

Add Code to Project Add button to project

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.SqlDataAdapter1.Fill(Me.PersonAddressDataset1) Dim i, j As Integer Dim TN, CN As String For i = 1 To Me.PersonAddressDataset1.Tables.Count TN = Me.PersonAddressDataset1.Tables(i - 1).TableName For j = 1 To PersonAddressDataset1.Tables(i - 1).Columns.Count CN = PersonAddressDataset1.Tables(i - 1).Columns(j - 1).ColumnName ListBox1.Items.Add(TN + " : " + CN) Next j Next i End Sub

Results of Code

Using Bindable Objects Add DataGridView

Setting Datagrid Properties Using the properties window use the drop-down On the DataSource property

Note the addition of the Binding Source

Binding Source In the DataGridView properties select the DataMember property and select SelectPersonAddress

Run Application When the Dataset is filled The bound grid automatically Populates.

Updating database Add button to application

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Me.SqlDataAdapter1.Update(Me.PersonAddressDataset1) End Sub

Make changes

Test the Update If update was successful the record will be changed. Close and re-open project and load dataset – was change persistent?

Review Creating a data adapter Using wizards to configure adapter Creating a Dataset Filling set from adapter Displaying data and table info Updating from bound object