ASP.NET - accessing the database - datareader vs dataset - datagrid vs datalist - brief look at web matrix.

Slides:



Advertisements
Similar presentations
Chapter 3 – Web Design Tables & Page Layout
Advertisements

RightNow 8 -- Adding a new report: New > Report: ORAnalytics > Reports > New Report
Data Base. Objective Become familiar with database terminology. Create a project to display data for a single database table. Use a DataGrid control.
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.
Jeopardy Objects Navigation Buttons True/False Parts of a Report Vocabulary Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400 Q $500 Final.
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
© 2007 by Prentice Hall10-1 Introduction to Oracle 10g Chapter 10 Creating and Modifying Reports James Perry and Gerald Post.
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.
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.
Integrating Access with the Web and with Other Programs.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
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.
Using ADO.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
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.
Introduction to Web Application Development with.Net and Web Service ISYS 350.
1 Pertemuan 09 Database Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
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.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
ASP and HTML. Anchor Tag testAnchorTag Demo: ASPNet/ASPNETProdListSelf.ASPX.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
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
Chapter 8 Binding Data to Web Controls. ASP.NET 2.0, Third Edition2.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
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 71 Building Data-Driven ASP.NET Applications Introduction to ASP.NET By Kathleen Kalata.
Website Development with Dreamweaver
Overview of Data Access MacDonald Ch. 15 MIS 324 Professor Sandvig.
CIS 451: Using ASP.NET Objects with SQL Dr. Ralph D. Westfall February, 2009.
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.
Microsoft Access 2010 Building and Using Queries.
INDIANAUNIVERSITYINDIANAUNIVERSITY OneStart page types  Tab – pages across the top, immutable  Section – pages down the left  Subsection – pages under.
Delivering Excellence in Software Engineering ® EPAM Systems. All rights reserved. Data Binding in ASP.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.
USING XML AS A DATA SOURCE. Data binding is a process by which information in a data source is stored as an object in computer memory. In this presentation,
XP 1 New Perspectives on XML Binding XML Data with Internet Explorer.
CIS 375—Web App Dev II ASP.NET 8 More Binding. 2 The Repeater ControlThe Repeater Control 1 The Repeater control is used to display a repeated list of.
Object Oriented Software Development 10. Persistent Storage.
Presented by Joseph J. Sarna Jr. JJS Systems, LLC
Tutorial 91 Databases A database is an organized collection of related information stored in a file on a disk A database allows companies to store information.
ASP.Net and HTML. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load dim strConn as string ="Provider=Microsoft.Jet.OLEDB.4.0;Data.
There are seven main components of a database in Access 2000: Tables. Use tables to store database information. Forms Use forms to enter or edit the information.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
TRAINING SESSIONS.NET Controls.  Standard Controls  Label  Textbox  Checkbox  Button, Image Button, Image control  Radio Button  Literal  Hyperlink.
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
ASP.NET - insert - delete -update DataTables (disconnected datasets) Shopping Basket.
2314 – Programming Language Concepts Introduction to ADO.NET.
1 Database Programming with ADO.NET Kashef Mughal.
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.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 8 1 Microsoft Office Access 2003 Tutorial 8 – Integrating Access with the.
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.
Using databases ActiveX Data Objects (ADO) Connecting to a database Reading data from a database Inserting, updating and deleting records Using databases.
ADO.NET Accessing Databases in VS.NET
Brief description on how to navigate within this presentation (ppt)
Lessons Vocabulary Access 2016.
Database Applications
PROG Advanced Web Apps 2/24/2019 Session 9.2 Data Binding Wendi Jollymore, ACES.
Chapter 10 Accessing Database Files
Topic 12 Lesson 2 – Retrieving Data with Queries
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

ASP.NET - accessing the database - datareader vs dataset - datagrid vs datalist - brief look at web matrix

Accessing the database 1.Open a connection to a database 2.Create a recordset to store retrieved data 3.Send SQL query to database 4.Store answer to SQL query in recordset 5.Close connection to database 6.Retrieve data from recordset fields to display onscreen 7.Close recordset

Open connection to database (1) Work out which connection driver you need Dim strConn as String strConn = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source = “ & Server.MapPath(“recruitment.mdb”)

Open connection to database (2) Give the string containing driver name & database location to the OleDbConnection Dim objConn as OleDbConnection objConn = New OleDbConnection(strConn) objConn.Open You could do both these steps on one line

Create a recordset to store retrieved data Dim objRS as OleDbDataReader Store SQL query in a String Dim querysql as String querysql = “SELECT * FROM JobList”

Send SQL query to database & store answer in recordset Dim strQuery as OleDbCommand strQuery = New OleDbCommand(querysql, objConn) objRS = strQuery.ExecuteReader Close connection to database objConn.Close

Retrieve data from recordset to display onscreen JobDataGrid.DataSource()=objRS JobDataGrid.DataBind() Close recordset strQuery.Dispose objRS.Close

DataReader vs DataSet

Extremely simplified summary: DataReader – Conveyer belt of data from database to.NET application (bridge) DataSet – Miniature in-memory copy of the database (usually just part of it)

DataReader Remains connected to the database – Only contains one row at a time – Can only go forwards – Can’t edit the data directly Different types for each provider – Microsoft uses OleDbConnection – SQL uses SQLConnection 30 (ish) times faster than a dataset Can be looped so all data is retrieved and stored in a table in memory

DataSet Disconnected – Retrieves all info in one go & stores in memory Editable Provider neutral – can also be used to access XML files Can be sorted or searched Very good for basic data-entry applications Useful for caching information to be shown on several pages across your website

DataGrid vs DataList Extremely simplified summary: DataGrid – table DataList – List – You design the layout yourself

DataGrid Most versatile, but least flexible Built-in paging, sorting & editing facilities Each row displays 1 record Can be nested Slowest to display on screen

DataGrid column types Bound Column – Value from datasource as plain text Button Column Edit Column HyperLink Column – Hyperlink, text & url may come from datasource Template Column – Customise html output of the column (allows nested grids)

DataList No built-in support for paging, sorting & editing Can display more than 1 record on each row Much more customisation of data layout is possible Can be nested (not as easy as datagrid)

DataList templates Header template Item template – Displayed once per row from recordset – Can be set to repeat using or HTML tags Alternating Item Template Edit Item Template Selected Item Template Separator Template Footer Template

Initial View

Data Tab – click here to establish connection to database

DataGrid HTML tab - Shows HTML code only Code tab - Shows ASP.NET code only All code at once Drag & drop

basic query builders This menu only visible in code tab

Auto-generated SELECT function Links datagrid to function when page is loaded

TO DO Oasisplus – ASP.NET : Activities 1 & 2