Ventsislav Popov Crossroad Ltd.. 1. ASP.NET Data Source Controls  SqlDataSource  EntityDataSource  ObjectDataSource 2. Entity Data Model and ADO.NET.

Slides:



Advertisements
Similar presentations
Internetteknologi (ITNET2) Presentation 21: ASP.NET Advanced.
Advertisements

Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
User Controls, Master Pages, GridView. Content User Controls Styles, Themes, Master Pages Working with Data GridView Muzaffer DOĞAN - Anadolu University2.
Unit 5: Building Presentation Layer Applications with ASP.NET 2.0.
ASP.NET Data Binding. Slide 2 Lecture Overview Understanding the ASP.NET data binding model.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
Introduction to Database Processing with ADO.NET.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
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.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify.
Introduction to ADO Entity Framework ir Denis VOITURON Source:
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
Some Basic Database Terminology
Philip Wolfe Senior Consultant Sogeti Session 3 - Leveraging Data in ASP.NET 2.0 (Level 200)
Chapter 8 Binding Data to Web Controls. ASP.NET 2.0, Third Edition2.
Chapter 9 Using the SqlDataSource Control. References aspx.
LINQ Boot Camp ADO.Net Entity Framework Presenter : Date : Mahesh Moily Nov 26, 2009.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
Entity Framework, a quickstart Florin−Tudor Cristea, Microsoft Student Partner.
ASP.NET Part 4 Instructor: Charles Moen CSCI/CINF 4230.
WEB325 Building Data-Driven Web Sites in ASP.NET 2.0 Rob Howard Telligent Corporation.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Databases in Visual Studio. Database in VisualStudio An MS SQL database are built in Visual studio The Name can be something like ”(localdb)\Projects”
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.
Building Data-Driven ASP.NET Web Forms Apps Telerik Software Academy ASP.NET Web Forms.
A Simple Introduction. What is ADO.net? First the word ADO stands for ActiveX Data Objects And it is an integral part of.Net Framework of Microsoft hence.
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.
Entity Framework Overview. Entity Framework A set of technologies in ADO.NET that support the development of data-oriented software applications A component.
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.
Malek Kemmou Technology Architect, Application Platform Microsoft Middle East and Africa Using Visual Studio 2005 to Build Data- Driven.
Ronnie Saurenmann Principal Architect Microsoft Switzerland.
DataSource controls in.NET How to access databases.
Meeting #6 – April 2011 – Web-Technologies Homework Assignments Svetlin Nakov Telerik Corporation
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.
Chapter 8 Working With Databases in ASP.NET. Listing 8.1 – ShowListControls Uses The SqlDataSource control for estabishing database connectivity and.
Data Access in ASP.NET 2.0 Bradley Millington Program Manager Web Platform and Tools.
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.
Oct * Brad Tutterow. VS 2008.NET 3.5LINQ Entity Framework  The ADO.NET Entity Framework is part of Microsoft’s next generation of.NET technologies.
EntityFrame work and LINQ CH 14. linq LINQ enables you to query data from a wide variety of data sources, directly from your programming code. LINQ is.
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.
11 The Repeater Control. 22 Objectives You will be able to use a Repeater Control to display data obtained with a SQL query with custom formatting.
Reference: “ASP.NET 2.0 Illustrated” by Alex Homer and Dave Sussman. -ch3 illustrated book
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
Ventsislav Popov Crossroad Ltd.. 1. ASP.NET Data Source Controls  SqlDataSource  EntityDataSource  ObjectDataSource 2. Entity Data Model and ADO.NET.
All information's of PLINQO in this Document, I got it from: So, you could visit the link above to research.
ASP.NET Data Binding. Slide 2 Lecture Overview Understanding the ASP.NET data binding model.
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.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 350.
ADO.NET 3.0 – Entity Data Model Gert E.R. Drapers Chief Software Architect Visual Studio Team Edition for Database Professionals Microsoft Corporation.
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.
Creating SQL Database file And Displaying a Database Table in a DataGridView.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Working with Data Lesson 4. Objectives DataSource Controls A requirement for most modern Web sites is that they be dynamic. –Static pages are not often.
Introduction to Database Processing with ADO.NET
Current Popular IT I Pertemuan 5
Introduction to Database Processing with ADO.NET
Lecture 6 VB.Net SQL Server.
Listing 9.1 ShowLocalConnection.aspx
Entity Framework By: Casey Griffin.
ADO.NET Entity Framework
ADO.NEXT Advances in Data Access for 2008
Database Applications
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

Ventsislav Popov Crossroad Ltd.

1. ASP.NET Data Source Controls  SqlDataSource  EntityDataSource  ObjectDataSource 2. Entity Data Model and ADO.NET Entity Framework 3. Using ASP.NET Data Source Controls  Editable Controls  Master-Detail Navigation 2

 ASP.NET provides server controls that take care of data binding details  Known as data source controls  SqlDataSource, EntityDataSource, ObjectDataSource, …  They are an abstraction over the data source  Data-bound server controls can be associated to a data source control  Through the DataSourceID property 4

 SqlDataSource provides connection to a relational DB (MS SQL Server, Oracle, …)  Data is manipulated by using commands  Select, Update, Insert and Delete  Commands can be either SQL queries or names of a stored procedures  Data is processed with a DataSet (by default)  The DataSourceMode property specifies whether to use DataSet or DataReader 5

6 <asp:GridView ID="GridViewCustomers" runat="server" DataSourceID="SqlDataSourceNorthwind"> DataSourceID="SqlDataSourceNorthwind"></asp:GridView> <asp:SqlDataSource ID="SqlDataSourceNorthwind" runat="server" ConnectionString= runat="server" ConnectionString= " " " " SelectCommand="SELECT [CompanyName], [ContactName], SelectCommand="SELECT [CompanyName], [ContactName], [PostalCode], [Phone], [Address] FROM [Customers]"> [PostalCode], [Phone], [Address] FROM [Customers]"></asp:SqlDataSource>  Note that your SQL is the presentation layer  Mixing presentation and database logic is very bad practice, so use SqlDataSource !

Live Demo

 EDM (Entity Data Model): conceptual Entity- Relationship data model  Entity: instances of Entity Types (e.g. Employee, SalesOrder) with an unique key, grouped in Entity-Sets  Relationship: associate entities, and are instances of Relationship Types (e.g. SalesOrder posted-by SalesPerson), grouped in Relationship-Sets 8

 ADO.NET EF: manages the transformations between the logical database in the relational store and the conceptual EDM  Generates an XML representation of a conceptual to logical mapping  ADO.NET client-views adapt the data to a shape that makes sense for the application without affecting the actual database  Querying Against an EDM Model (eSQL) 9

 The EntityDataSource  Provides data binding in Web applications that use the ADO.NET EF  Part of the.NET Framework 3.5, beginning with SP1 and above  Manages create, read, update, and delete operations against a data source on behalf of data-bound controls  The Entity Data Model Designer supports creating mapping scenarios 10

 Pros  The schema can be automatically updated for underlying changes made to the database structures.  TIMESTAMP concurrency is supported  Cons  Views which do not have any underlying unique keys are not able to be added to the data model 11

1. Define the data model (e.g. Entity Data Model) 2. Create a basic listing (e.g. ListBox ) 12

3. Bind the ListBox to the data model 4. Select the new "Entity" option in the dialog box 13

5. Designer will then display the available Entity Containers 14

Live Demo

 ObjectDataSource enables data-binding of UI control to an object  Instead of directly binding to a database  Needs a middle-tier business object  Data manipulation is based on methods  TypeName – name of the business object  DataObjectTypeName – a class holding the Select, Update, Insert, Delete methods  SelectMehtod, UpdateMethod, … 16

17 <asp:ObjectDataSource ID="dsProducts" runat="server" TypeName="ObjectDataSourceProducts" runat="server" TypeName="ObjectDataSourceProducts" DataObjectTypeName="Product" DataObjectTypeName="Product" SelectMethod="GetAll" InsertMethod="Insert" SelectMethod="GetAll" InsertMethod="Insert" UpdateMethod="Update" DeleteMethod="Delete"> UpdateMethod="Update" DeleteMethod="Delete"></asp:ObjectDataSource> <asp:GridView ID="GridViewProducts" runat="server" DataSourceID="dsProducts" DataKeyNames="ProductID"> DataSourceID="dsProducts" DataKeyNames="ProductID"></asp:GridView>

Live Demo

1. Define the data model (Entities to SQL) 2. Add new class Categories 3. Add method GetAllCategories in the Categories class 19 public static DataClassesObjectContext objectContext = new DataClassesObjectContext(); new DataClassesObjectContext(); public static IQueryable GetAllCategories() { var categories = var categories = from category in dataContext.Categories from category in dataContext.Categories orderby category.CategoryName select category; orderby category.CategoryName select category; return categories; return categories;}

4. Add ListView and FormView controls to the aspx page 5. Bind the ListView to the ObjectDataSource 20

6. Next choose your custom class Categories 7. And choose method GetAllCategories 21

8. Click to configure the ListView control 9. Optionally choose layout and style 22

10. Delete from all templates the row which represent pictures 11. Bind the FormView to ObjectDataSource and enable paging 23

12. The result is: 24

 LinqDataSource (for LINQ-to-SQL mappings)  Hierarchical  XmlDataSource  Establishes a connection to an XML source of data (files, documents)  DataFile, TranformFile, XPath  SiteMapDataSource  MS Access – AccessDataSource  Derives from SqlDataSource  DataFile 25

Questions?