Chapter 10 Managing Data with ASP.NET. ASP.NET 2.0, Third Edition2.

Slides:



Advertisements
Similar presentations
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.
Advertisements

AN INTRODUCTION TO PL/SQL Mehdi Azarmi 1. Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database.
User Controls, Master Pages, GridView. Content User Controls Styles, Themes, Master Pages Working with Data GridView Muzaffer DOĞAN - Anadolu University2.
Chapter 9 Customizing Data with Web Controls. ASP.NET 2.0, Third Edition2.
ASP.NET Data Binding. Slide 2 Lecture Overview Understanding the ASP.NET data binding model.
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.
VBA Modules, Functions, Variables, and Constants
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Building ASP.NET Applications 2 Lecture 3,4 T. Ahlam Algharasi 4 th Level.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Microsoft Office Word 2013 Expert Microsoft Office Word 2013 Expert Courseware # 3251 Lesson 4: Working with Forms.
MS Access Advanced Instructor: Vicki Weidler Assistant:
8 Copyright © 2004, Oracle. All rights reserved. Creating LOVs and Editors.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Chapter 8 Binding Data to Web Controls. ASP.NET 2.0, Third Edition2.
Chapter 9 Using the SqlDataSource Control. References aspx.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Copyright © 2001 by Wiley. All rights reserved. Chapter 10: Advanced Database Operations Revising Vintage Videos Setting RecordSource at run time DBGrid.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
MSIS 5133 Advanced MIS - E-Commerce Spring 2003 Lecture 4: DotNet Technologies - Part 4 Using Controls with Databases Dr. Rathindra Sarathy.
Chapter 81 Building Data-Driven Web Applications Introduction to ASP.NET By Kathleen Kalata.
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
Chapter 71 Building Data-Driven ASP.NET Applications Introduction to ASP.NET By Kathleen Kalata.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
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.
Introduction to Entity Framework Part 2 CRUD Scaffolding Tom Perkins NTPCUG.
Unit 8.3 Learning Objectives Insert users into the ASP.NET Membership system from code Capture data being sent to the database Capture Exceptions that.
Delivering Excellence in Software Engineering ® EPAM Systems. All rights reserved. Data Binding in ASP.NET.
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.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Chapter 8 Working With Databases in ASP.NET. Listing 8.1 – ShowListControls Uses The SqlDataSource control for estabishing database connectivity and.
ASP.NET OPTIMIZATION. Why Optimize? $$$ Whether you build applications for customers or not, enhanced applications save money.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflows can be triggered by inputs that are designed to execute code, or alter the way the program.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
Data-Driven - 1 © Minder Chen, Building Data-Driven Web Sites in ASP.NET 2.0.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
TRAINING SESSIONS.NET Controls.  Standard Controls  Label  Textbox  Checkbox  Button, Image Button, Image control  Radio Button  Literal  Hyperlink.
Reference: “ASP.NET 2.0 Illustrated” by Alex Homer and Dave Sussman. -ch3 illustrated book
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflow Analysis of Buffer Overflow Attacks.
1 Database Design and Development: A Visual Approach © 2006 Prentice Hall Chapter 12 DATABASE DESIGN AND DEVELOPMENT: A VISUAL APPROACH Chapter 12 Accessing.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
1 CS 3870/CS 5870: Note07 Prog 4. Master Pages Creating a master page based on another master page MainMasterPage –For all Progs and Tests Prog4MasterPage.
1 CS 3870/CS 5870: Note07 Prog 4. Master Pages Creating a master page based on another master page MainMasterPage –For all Progs and Tests Prog4MasterPage.
Unit 8.2 Learning Objectives Data Warehouses – The Role of Data Warehouses The Role of Data Warehouses – Group Exercise Accessing Data in Views – Accessing.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
Module 10: Data Access in ASP.NET. Overview Overview of the ASP.NET Data Access What is Data Access List of Data Source Control What is Data Bound How.
CHAPTER 7 LESSON C Creating Database Reports. Lesson C Objectives  Display image data in a report  Manually create queries and data links  Create summary.
SQL Triggers, Functions & Stored Procedures Programming Operations.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
CHAPTER 7 LESSON B Creating Database Reports. Lesson B Objectives  Describe the components of a report  Modify report components  Modify the format.
ASP.NET Programming with C# and SQL Server First Edition
Unit 9.1 Learning Objectives Data Access in Code
Working in the Forms Developer Environment
Unit 8.2 How data can be used Accessing Data in Views
Listing 9.1 ShowLocalConnection.aspx
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
© 2016, Mike Murach & Associates, Inc.
Chapter 10 ADO.
Presentation transcript:

Chapter 10 Managing Data with ASP.NET

ASP.NET 2.0, Third Edition2

 To maintain a database you must be able to create new records, modify existing records, and delete records  You can accomplish this by using SQL commands or by using the methods built into the Data controls  You either can use the Command Builder method built into the GridView, DataList, and Repeater controls to help you build methods and procedures to maintain the database, or you can create your own methods to interact with the Data controls and database ASP.NET 2.0, Third Edition3

 The InsertItemTemplate template is used to display the bound data in a read-only format  However, you can modify the template to change how the data is displayed  The EditItemTemplate template is used to format the controls that are available in edit mode  The SelectedItemStyle identifies the style for the currently selected row  The EditItemStyle identifies the style for the row that is currently being edited ASP.NET 2.0, Third Edition4

 Parameters passed to the Select statement are called SelectParameter objects and are collectively called the SelectParameters collection  There are also InsertParameter, UpdateParameter, DeleteParameter, and FilterParameter objects for the insert, update, delete, and filter queries  ControlParameter: Allows you to retrieve the value from a property of a server control on a web page using the PropertyName property ASP.NET 2.0, Third Edition5

 CookieParameter: Allows you to retrieve the value from an HTTP cookie using the CookieName property  FormParameter: Allows you to retrieve the value from a form control on a web page using the FormField property  ProfileParameter: Allows you to retrieve the value from the user profile using the ParameterName property  QueryStringParameter: Allows you to retrieve the value from a QueryString using the QueryStringField property  SessionParameter: Allows you to retrieve the value from a Session variable using the SessionField property ASP.NET 2.0, Third Edition6

 The FilterParameter object is set to the value of a parameter used in a FilterExpression  The FilterParameter is defined in the DataSource control as a Parameter object  Both the FilterExpression property and FilterParameter object can be defined within the DataSource object or programmatically  Filtering data only is supported if the Select statement returns a DataSet, DataTable, or DataView object but not with the DataReader object ASP.NET 2.0, Third Edition7

8

9

10

 By default, each column heading in the GridView control will be displayed as a hyperlink when sorting is enabled  Then, for each bound column in the GridView control, assign the SortExpression property to the name of the column that you want to be sorted  Usually the value of the SortExpression property is the same as the DataField property ASP.NET 2.0, Third Edition11

ASP.NET 2.0, Third Edition12

ASP.NET 2.0, Third Edition13

ASP.NET 2.0, Third Edition14

ASP.NET 2.0, Third Edition15

ASP.NET 2.0, Third Edition16

ASP.NET 2.0, Third Edition17

 Set the deleting and inserting in the Task List for the GridView control  Although you can create code to insert a new record with the GridView control, the ShowInsertButton for the control is set to False by default  Using the insert methods with the GridView control would require additional programming and is not as flexible as using the DetailsView control to insert a new record ASP.NET 2.0, Third Edition18

ASP.NET 2.0, Third Edition19

 You can bind data sources to a FormView control to insert, edit, and delete records  You can use the pager row to allow users to page through each record to locate the record that they want to edit  With large record sets, however, this is impractical; therefore, you should learn how to bind a value returned from the Data control to the query for retrieving a record in the FormView control  The FormView DefaultMode property can be set inside of the FormView tag; the CurrentMode property is used to identify the current mode  You can also change the mode programmatically; you can assign the value using the ChangeMode method of the FormView control ASP.NET 2.0, Third Edition20

ASP.NET 2.0, Third Edition21

ASP.NET 2.0, Third Edition22

ASP.NET 2.0, Third Edition23

 Stored procedures are SQL queries that are stored with the database and can be reused; t hey can contain SQL commands and can be as simple as a Select statement.  Stored procedures are queries that reside on the database server, and because they are compiled by the database server, they are more efficient  Both AccessDataSource and SqlDataSource controls can be configured to pass parameters to an SQL query or to a stored procedure  SQL statements can be saved as a stored procedure and executed at a later time  When the stored procedure is called, you can then pass the value of the parameter ASP.NET 2.0, Third Edition24

ASP.NET 2.0, Third Edition25

ASP.NET 2.0, Third Edition26

ASP.NET 2.0, Third Edition27

ASP.NET 2.0, Third Edition28

ASP.NET 2.0, Third Edition29

ASP.NET 2.0, Third Edition30

ASP.NET 2.0, Third Edition31

ASP.NET 2.0, Third Edition32

ASP.NET 2.0, Third Edition33

ASP.NET 2.0, Third Edition34

ASP.NET 2.0, Third Edition35

 SQL injection is a technique that is used by hackers to attach SQL statements to an existing SQL query in order to run additional commands  When a user enters data within a text box that is combined with an SQL statement, the hacker can insert additional SQL statements within that text box.; this action injects the hacker’s own SQL commands  To prevent SQL injection, always use stored procedures with sensitive data  Secure your SQL Server database by not leaving your password blank and by using a strong password; a strong password uses a combination of numbers and special characters to make it more difficult to guess ASP.NET 2.0, Third Edition36

 If the record is not added successfully and an exception is triggered, the web page can catch the exception as an Exception object  The Exception object contains information about the error, such as the exception number, which helps you determine the type of error that occurred  The Try-Catch construct allows you to place code in the Try section that you want to execute  If an exception is thrown within this code, the code within the Catch section runs; the exception can be caught and stored as an object in a variable  You can access the exception number using the Number property of the Exception object ASP.NET 2.0, Third Edition37

ASP.NET 2.0, Third Edition38

 Data controls can be bound to a variety of data sources. You can dynamically display the data by controlling when the BindData method is called. You can bind all of the controls at once or do so individually.  Data can be filtered using the SQL statement with the WHERE clause, or by using a parameter, such as a FilterParameter, or by using the FilterExpression property.  The EditItemTemplate property is used to format the controls that are available in edit mode. The EditItemStyle identifies the style for the row that currently is being edited. You can bind the controls by using a variety of controls such as the TemplateField, HyperLinkField, and CheckBoxField. ASP.NET 2.0, Third Edition39

 The CommandField contains an Edit, Update, and Cancel hyperlink for editing, deleting, and canceling your editing requests. You can change the hyperlink to a button with the ButtonType property. You need to enable editing and deleting for the GridView control. The methods are built into the control, however. Therefore, you do not have to write custom code for basic web database management.  The DetailsView or FormView controls should be used for inserting new records instead of the GridView control. The InsertTemplate is used to configure the columns and values to insert into the new record. ASP.NET 2.0, Third Edition40

 The DefaultMode for the FormView control is ReadOnly. You can programmatically modify the mode using the ChangeMode method, or by explicitly modifying the DefaultMode or CurrentMode property.  Stored procedures can improve efficiency within your program, decrease maintenance requirements, decrease design time errors, and improve data integrity and security.  Data controls can be bound to a variety of data sources. You can dynamically display the data by controlling when the BindData method is called. You can bind all of the controls at once or do so individually.  Data security is one aspect that should be included in your company information systems security policy. SQL injection is a technique that is used by hackers to attach SQL statements to an existing SQL query in order to run additional commands.  Try-Catch can help identify and handle errors with database applications. ASP.NET 2.0, Third Edition41