PROG11044 - Advanced Web Apps 4/13/2019 Programming Data Pages Wendi Jollymore, ACES.

Slides:



Advertisements
Similar presentations
17. Data Access ADO.Net Architecture New Features of ADO.NET
Advertisements

ADO.Net Modelo para acesso a dados nas aplicação.Net Componentes: DataSet.Net Data providers: Connection Command DataReader DataAdapter.
ADO.NET: Working in Disconnected Environment Sergey Baidachni MCT, MCSD, MCDBA.
Chapter 10 ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a programming interface to access data in a database.
1 ADO.NET. 2.NET Framework Data Namespaces System.Data –Base set of classes and interfaces for ADO.NET System.Data.Common –Classes shared by the.NET Data.
ADO. NET. What is “ADO.Net”? ADO.Net is a new object model for dealing with databases in.Net. Although some of the concepts are similar to the classical.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Stored Procedures Dr. Ralph D. Westfall May, 2009.
Chapter 9 Using the SqlDataSource Control. References aspx.
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.
Chapter 61 Managing Data Sources Introduction to ASP.NET By Kathleen Kalata.
ADO.NET Tools and Wizards. Slide 2 Data Sources Window (Introduction) Use the Data Sources window to Establish a connection Create bound control instances.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
Developing Web Applications Using Microsoft ® Visual Studio ® 2008.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
CIS 375—Web App Dev II ASP.NET 10 Database 2. 2 Introduction to Server-Side Data Server-side data access is unique in that Web pages are basically ___________.
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.
Databases and Data Access  Introduction to ADO.NET  ADO.NET objects  ADP.NET namespaces  Differences between ADO and ADO.NET.
ADO.Net CS795. What is ADO.Net? Database language spoken by managed applications ADO.net database accesses go through modules: data providers –SQL Server.Net.
.NET Data Access and Manipulation ADO.NET. Overview What is ADO.NET? Disconnected vs. connected data access models ADO.NET Architecture ADO.NET Core Objects.
1 Introduction to ADO.NET Microsoft ADO.NET 2.0 Step by Step Rebecca M Riordan Microsoft Press, 2006.
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
ASP.NET Rina Zviel-Girshin Lecture 5
Session 8: ADO.NET. Overview Overview of ADO.NET What is ADO.NET? Using Namespaces The ADO.NET Object Model What is a DataSet? Accessing Data with ADO.NET.
Module 7: Accessing Data by Using ADO.NET
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Introduction to ADO.NET ADO.NET - Lesson 01  Training time: 10 minutes  Author:
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
An Introduction to ADO.Net Marmagna Desai.NET Seminar, Fall-2003.
 It is the primary data access model for.Net applications  Next version of ADO  Can be divided into two parts ◦ Providers ◦ DataSets  Resides in System.Data.
1 Data Classes- DataView DataGridView Control. Objectives 2  Data Class  DataAdapter  DataReader  DataSet  DataTable  DataView  DataGridView Control.
Mauricio Featherman, Ph.D. Washington St. University
ADO.Net CS795. What is ADO.Net? Database language spoken by managed applications ADO.net database accesses go through modules: data providers –SQL Server.Net.
Module 3: Working with Local Data. Overview Using DataSets Using XML Using SQL Server CE.
1 11/15/05CS360 Windows Programming ADO.NET Continued.
HNDIT Rapid Application Development
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
1 Database Programming with ADO.NET Kashef Mughal.
C# .NET Software Development
Active Data Objects Using.Net ADO.Net Farooq Ahmed Amna Umber Summayya Shehzad.
Module 2: Using ADO.NET to Access Data. Overview ADO.NET Architecture Creating an Application That Uses ADO.NET to Access Data Changing Database Records.
Data Access. ADO.NET ADO.NET is the primary library for building database solutions within the.NET Framework. ADO.NET does not replace ADO. ADO and OLEDB.
ADO .NET from. ADO .NET from “ADO .Net” Evolution/History of ADO.NET MICROSOFT .NET “ADO .Net” Evolution/History of ADO.NET History: Most applications.
.NET Data Access and Manipulation
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
 ADO.NET is an object-oriented set of libraries that allows you to interact with data sources  Commonly, the data source is a database, but it could.
Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#
ASP.NET Programming with C# and SQL Server First Edition
Introduction to ADO.NET
Introduction to Database Processing with ADO.NET
Database, SQL and ADO.NET
Copyright Scott-Jones Publishing, All rights reserved.
Introduction to Database Processing with ADO.NET
Relational Model.
ADO.NET Framework.
PROG Advanced Web Apps 5/23/2018 Notes on ADO.NET (1) Wendi Jollymore, ACES.
An Introduction to ADO.Net
Programming the Web Using ASP.Net
Active Data Objects Binding ASP.NET Controls to Data
Unit 9.2 Database access from code Database Cycle Review
VB.NET Using Database.
Tonga Institute of Higher Education
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Chapter 10 ADO.
PROG Advanced Web Apps 2/24/2019 Session 9.2 Data Binding Wendi Jollymore, ACES.
Active Data Objects Binding ASP.NET Controls to Data
M S COLLEGE OF ART’S, COMM., SCI. & BMS Advance Web Programming
Introduction to Database Programming through ADO. NET
Presentation transcript:

PROG11044 - Advanced Web Apps 4/13/2019 Programming Data Pages Wendi Jollymore, ACES

Review So Far Classes we used: SqlConnection SqlCommand A connection object that facilitates communication with the database SqlCommand A command object that models a specific SQL command to be executed over a specific connection Connection property – references a connection object CommandText property – contains the SQL command to execute 4/13/2019 Wendi Jollymore, ACES

Review So Far SqlDataReader A forward-only, read-only set of records Returned by the command object’s ExecuteReader() method command.ExecuteReader() executes the CommandText query over the Connection object The resulting rows or records are returned as a Data Reader object 4/13/2019 Wendi Jollymore, ACES

Review So Far SqlDataReader, continued Read() method Returns true if it read a record Used to move through the records reader[“fieldName”] syntax Allows you to access the field values in the current record 4/13/2019 Wendi Jollymore, ACES

Review So Far SqlParameter Some SQL statements will contain values that are dynamic E.g. select * from authors where authorID = ? The ? Value could come from a list box selection Parameter objects are used to replace unknown or variable values More secure than concatenating values together to build SQL statements 4/13/2019 Wendi Jollymore, ACES

The DataSet Object System.Data.DataSet A virtual database The client machine can download a copy of the tables/query results they want DataSet data can be modified You can move around in a data set i.e. it’s not forward-only The data set object can be used with any provider 4/13/2019 Wendi Jollymore, ACES

The DataSet Object A DataSet contains a collection of tables It contains information about the tables, such as: Schema Records Relationships Constraints 4/13/2019 Wendi Jollymore, ACES

The DataSet Object DataSet.Tables property References the collection of tables This collection object is an instance of the DataTableCollection class A DataTableCollection object contains a set of DataTable objects Each DataTable object in the DataTableCollection is one of the tables in the database 4/13/2019 Wendi Jollymore, ACES

The DataSet Object Ways to reference a table in the dataset: dataSet.Tables[“Books”] dataSet.Tables[0] 4/13/2019 Wendi Jollymore, ACES

The DataTable Object Models a table from the database dataTable.Rows property References the DataRowCollection object A collection of DataRow objects The set of rows (records) in the table 4/13/2019 Wendi Jollymore, ACES

The DataTable Object dataTable.TableName property The name you gave the table when you added it to the data set dataTable.Columns property References the DataColumnCollection object A collection of DataColumn object The set of columns (fields) in the table dataTable.Columns.Count property The number of columns in the table 4/13/2019 Wendi Jollymore, ACES

The DataRow Object Models a row (record) in the row collection of the table dataTable.Rows.Count property The number of DataRow objects in the DataRowCollection i.e. the number of records dataTable.Rows.Find(keyValue) Used to locate a specific record in the collection keyValue is the value for the primary key field to match 4/13/2019 Wendi Jollymore, ACES

The SqlDataAdapter Object A data adapter facillitates communication between the DataSet and the data source DataSet is not provider specific Everything else is The data adapter will pass any data from the data source to the DataSet The data adapter will also handle the data manipulation for you 4/13/2019 Wendi Jollymore, ACES

The SqlDataAdapter Object SelectCommand property Contains a command object that contains a SELECT query UpdateCommand, DeleteCommand, InsertCommand properties Contains command objects for UPDATE, DELETE, and INSERT commands Command objects have their own connection, so that connection is used to execute the various commands 4/13/2019 Wendi Jollymore, ACES

The SqlDataAdapter Object dataAdapter.Fill(dataSet) method Executes the query in the SelectCommand property’s command object Fills the dataset with the results of that query dataAdapter.Fill(dataSet, strName) As above but assigns the result table with strName as a table name Accessed via dataSet.Tables[strName] 4/13/2019 Wendi Jollymore, ACES

Exercise ADO Notes: “Advanced Programming” Do the tutorial “Working with the DataSet” Do the “Multiple Tables in a DataSet” tutorial and exercise 4/13/2019 Wendi Jollymore, ACES

Iterating Through Records There are a few ways you can iterate through the collection of data rows (records) The rows collection can be used to access records and field values: Get the third row: DataRow aRow = dataSet.Tables[“Authors”].Rows[3]; Get the last name field value from the 1st row: String lastName = aRow[“lastName”]; String lastName = dataSet.Tables[“Authors”].Rows[3][“lastName”]; 4/13/2019 Wendi Jollymore, ACES

Iterating Through Records dataRow.ItemArray property References the field values in a row as an array of generic objects You can retrieve this array and then iterate through it: object[] values = dataSet.Tables[“Books"].Rows[rowIndex].ItemArray; for (int i=0; i<values.Length; i++) { string output += values[i].ToString(); } 4/13/2019 Wendi Jollymore, ACES

Exercise Try the two exercises in the section “Displaying Records Programmatically” Do the “Navigating Records” exercise 4/13/2019 Wendi Jollymore, ACES