2314 – Programming Language Concepts Introduction to ADO.NET.

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.
Coding ADO.Net DataSet Objects ISYS 512. DataSet Object A DataSet object can hold several tables and relationships between tables. A DataSet is a set.
Data Base. Objective Become familiar with database terminology. Create a project to display data for a single database table. Use a DataGrid control.
By Chris Pascucci and FLF
Introduction to Database Processing with ADO.NET.
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.
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.
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.
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.
1 Pertemuan 09 Database Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
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.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
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.
ADO.NET – part II August 2004 [ Marmagna Desai]. CONTENTS ADO vs ADO.NET ADO.NET – Managed providers Connecting to Database SqlConnection Selecting Database.
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.
ODBC, OLE DB, and ADO Introduction Dr. Ron Eaglin.
ASP.Net Web Applications. Characteristics of a typical data driven web application Web Server HTML Graphics Active-X Java Applets HTTP Request ADO / JDBC.
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.
Overview of Data Access MacDonald Ch. 15 MIS 324 Professor Sandvig.
1 ASP.NET ASP.NET Rina Zviel-Girshin Lecture 4. 2 Overview Data Binding Data Providers Data Connection Data Manipulations.
Web Services Week 8 Aims: –Using web services as front ends to databases Objectives: –Review of relational databases –Connecting to and querying databases.
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.
© 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 - accessing the database - datareader vs dataset - datagrid vs datalist - brief look at web matrix.
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
Module 9: Accessing Relational Data Using Microsoft Visual Studio.NET.
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.
Keywords Searching and Analysis System Member Student ID Role 刘亮 Liu Liang System Analyst 顾子俊 Gu Zijun Developer 杜菡菡 Du Hanhan
Christopher M. Pascucci.NET Programming: Databases & 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:
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.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
 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.
Mauricio Featherman, Ph.D. Washington St. University
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
ASP.NET - insert - delete -update DataTables (disconnected datasets) Shopping Basket.
Module 3: Working with Local Data. Overview Using DataSets Using XML Using SQL Server CE.
Databases – Unit 3 & 4.  SQL is not restricted to a specific database, however in class we will be looking at the two major database programmes in use.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
Module 4 Introduction ADO.NET.
ADO.NET in VB.NET 2005 ITE 370 4/26/2017.
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.
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.
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.
Introduction to Database Processing with ADO.NET
Introduction to Database Processing with ADO.NET
ADO.NET Framework.
Programming the Web Using ASP.Net
Lecture 6 VB.Net SQL Server.
ADO.NET Accessing Databases in VS.NET
VB.NET Using Database.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Chapter 10 Accessing Database Files
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

2314 – Programming Language Concepts Introduction to ADO.NET

Overview of Database Terminology Fields = attributes –Each field has a type –Some optional, some required Rows = instances (record) Common operations –INSERT –DELETE –UPDATE

Multi-Tiered Client-Server Model "Thin" client Code/work on server Ultimate in portability Makes upgrades easier Connectivity necessary Scalability important Client Server TCP/IP DB1 DB2 Data Services

Server-Side Processing Server-Backend Communication Server analyzes client request Realizes it needs the backend Server requests a DB transaction with backend Backend formulates response and sends to server Server formats information into HTML Server sends information to client

Sample ASP Code Verifying User Informaiton <% dim objConn, objRS, strSQL, strUser, strPass, strBID, strBook set objConn = Server.CreateObject("ADODB.Connection") objConn.Open "ITLibrary", "user", "nothing" strUser = Request.Form("User") strPass = Request.Form("Pass") strSQL="SELECT SID FROM Student WHERE S ='" & strUser & "' and SPASS='" & strPass & "'" set objRS=objConn.Execute(strSQL) %>

Sample ASP Code (cont) Username or Password is not correct or not found Click here to try again Navigate("booklist.asp")

Sample ASP DB Table First Name Last Name Phone <% do until rs.EOF Response.Write " " Response.Write " " & rs("au_fname") & " " Response.Write " " & rs("au_lname") & " " Response.Write " " & rs("phone") & " " Response.Write " " rs.MoveNext loop %>

Sample ASP.NET DB Table void Page_Load(Object Src, EventArgs E) { DataSet DS; SQLConnection MyConnection; SQLDataAdapter MyCommand; MyConnection = new SQLConnection("server=localhost;uid=sa;pwd=;database=pubs"); MyCommand = new SQLDataAdapter("select au_fname as 'First Name', au_lname as 'Last Name', Phone from Authors", MyConnection); DS = new DataSet(); MyCommand.Fill(ds, "Authors"); grdAuthors.DataSource=ds.Tables["Authors"].DefaultView; grdAuthors.DataBind(); }

Adding the DataGrid Object to HTML Utilize the DataGrid System control: Authors Information is current as of

Important ASP.NET Classes/Methods SqlConnection / OleDbConnection SqlDataAdapter / OleDbDataAdapter –Fill OleDbDataReader & OleDbCommand DataSet DataGrid –DataSource –DataBind –Columns, BoundColumn, HyperLinkColumn

C# Data Binding OLE vs. SQL –Just different means to connect –SQL for SQL Server –OLE for all other DBs –We’ll use OLE to connect to an Access DB In Studio.NET, use the “Data” panel of the Toolbox to access the DB controls In WebMatrix, drag/drop table onto form

How the Connection Works Three key non-visual controls (for OLE): –OleDbDataAdapter –OleDbConnection –DataSet DB Connection Data Adapter DataSet Visual Controls The user only cares about (and only sees) these Behind the scenes “overhead”

DataAdapter Creates a link to the DB connection Passes the SQL to the DB connection Manages the DB connection - internally DB DataAdapter ASP.NET

DataTable Columns = fields (names & data types) Rows = records Local, in-memory copy of DB records Can move forward, backward through data

DataSet Collection of DataTables In-memory object DataTable 1DataTable 2DataTable 3 DataSet 1

Binding & Filling DataTables Connect to DB Configure DataAdapter (SQL statement) Execute DataAdapter’s SQL and fill a DataTable w/ the results

ASP.NET Example OleDbDataAdapter dap; OleDbConnection conn; DataSet dset; dap = new OleDbDataAdapter(“select * from members order by memberid”, conn); dset = new DataSet(); dap.Fill(dset, “Members”); grid.DataSource = dset.Tables(“Members”); grid.DataBind;

Accessing & Updating Accessing items/fields is quite easy: dset.Tables(TABLE).Rows(N).Item(X); DataSets & DataTables are LOCAL copies of the DB – so changes are not persistent! Updating the DB is easy too: dap.Update(dset, TABLE);