HNDIT Rapid Application Development

Slides:



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

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.
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.
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.
Introduction to Data Adapter. A Simplified View of ADO.Net Objects Ado.Net Data Provider Connection Adapter Command Reader Dataset Data Consumer WinForm.
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.
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.
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.
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.
Programming in ADO.NET: Data-Centric Applications and ADO.NET Original copyright by Microsoft, 2002, with minor modifications by Dan Eaves, 2005.
Objective In this session we will discuss about : What is ADO. NET ?
Chapter 8 Binding Data to Web Controls. ASP.NET 2.0, Third Edition2.
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.
ODBC, OLE DB, and ADO Introduction Dr. Ron Eaglin.
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.
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.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
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.
1 Introduction to ADO.NET Microsoft ADO.NET 2.0 Step by Step Rebecca M Riordan Microsoft Press, 2006.
Database, SQL, and ADO.NET- Part 1 Session 11 Mata kuliah: M0874 – Programming II Tahun: 2010.
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.
Module 7: Accessing Data by Using ADO.NET
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:
Presented by Joseph J. Sarna Jr. JJS Systems, LLC
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.
ADO.NET Objects – Data Providers Dr. Ron Eaglin. Requirements Visual Studio 2005 Microsoft SQL Server 2000 or 2005 –Adventure Works Database Installed.
 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.
The Problems HTTP is disconnected So many database vendors Create a simple consistent versatile interface on the data Look at ADO.NET classes OleDb SQL.
Mauricio Featherman, Ph.D. Washington St. University
Module 3: Working with Local Data. Overview Using DataSets Using XML Using SQL Server CE.
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
Module 4 Introduction ADO.NET.
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.
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
C# 1 CSC 298 ADO.NET. C# 2 ADO.NET  A data access technology that maps very well to the world of the web (disconnected architecture)  data is retrieved.
 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.
Integrating Data Lesson 6.
ASP.NET Programming with C# and SQL Server First Edition
Data Access with ADO.NET
Introduction to ADO.NET
Introduction to Database Processing with ADO.NET
Introduction to Database Processing with ADO.NET
ADO.NET Framework.
How to Create Login Form using vb.net and SqlServer Database
Lecture 6 VB.Net SQL Server.
Active Data Objects Binding ASP.NET Controls to Data
VB.NET Using Database.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Chapter 10 ADO.
Chapter 10 Accessing Database Files
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:

HNDIT23073- Rapid Application Development Week 7,8-Visual Basic: ADO. Net Introduction

Introduction Data is generally stored in a relational database in the form of related Tables. Retrieving & Manipulating data directly from a database requires the knowledge of database commands to access the data. Eg. SQL Server database may not be convenient for a person who does not know SQL statements.

Business Application Business application allows users to retrieve the data stored in a database & present it in user friendly interface. Without having to write database command. User can even add, delete ,update database record directly from application

Applications Need for… Retrieving the data stored in the database & presenting it in a user friendly manner Updating the database ADO.NET is a model used by .NET application to communicate with the database for retrieving & updating Data.

Features of ADO.NET Disconnected Data Architecture Application connect to the database only while retrieving & updating data After the data retrieved, the connection with the data is closed If we want ,Connection is reestablished Reduce the wastage of valuable system resources

Features of ADO.NET Data cached in datasets Dataset is the most common method of accessing data in ADO.NET ADO.NET based on disconnected architecture, it is not possible for application to interact with the database for processing each record So the data is retrieved and stored in datasets

Dataset A dataset is a cached set of database records. Can work with the records stored in a dataset as real data. Only, difference is, dataset is independent of data source.

Features of ADO.NET ADO.NET supports scalability by working with dataset Dataset operations are performed on dataset instead of on the database As a result, resources are saved & the database can meet increasing demands of users more efficiently.

Features of ADO.NET Data transfer in XML format XML is the fundamental format for data transfer in ADO.NET Data is transferred from a database in to a dataset and from dataset to another component by using XML Can use an XML file as a data source & store data from it in a dataset

Features of ADO.NET Interaction with the database is done through data commands A data command object can be used for accessing or updating the data using either a SQL statement or a stored procedure Can retrieve insert ,delete or modify data from a database by executing data commands

ADO.NET object Modal

ADO .NET The data residing in a database is retrieved through data provider An application can access either through a dataset or data Reader objects

Using dataset Data is cached in a dataset and the application access the data from dataset

DataReader is component of a data provider Uses connection object to connect to the database uses the command object to retrieve data provides data to the application in a read only & forward only mode

Data Provider Data provider is used for Connecting to database Retrieving data Storing the data in a dataset Reading the retrieved data and updating database

Data Provider Cont Two types of data provider OLEDB data provider Works with all OLEDB providers such as SQL OLEDB,JET OLEDB , Oracle OLEDB OLEDB data provider classes are present in the System.Data.Oledb namespace SQL Server data provider Used to work with specifically with Microsoft SQL server SQL server data provider allow fast access to data source SQL server data provider classes are present in the System.Data.Sqlclient namespace

Components in Data Provider Connection Data Adapter Data Command Data Reader

1. Connection Used to established a connection with a data source Two of the most common connection objects OleDbconnection SqlConnection

1. Connection cont Properties & Methods of a connection objects ConnectionString property Provide information such as the data source database name That is used to established connection with a database Open() method Use to open a connection with the data source that is specified in the ConnectionString property Close () method Use to close the connection with a data source State property() Use to describe the current state of the connection object 0-the connection is closed 1-the connection is open

2. Data Adapter A data adapter is integral to the working of ADO.NET Data is transferred to and from a database through a data adapter It retrieves data from a database into a dataset When you make changes to the dataset, the changes in the database are actually done by the data adapter Data adapter first compare the data in the dataset with that in the database and then updates the database You access data from a database by configuring a data adapter

2. Data Adapter cont Two data adapters in VB.NET Sql Data Adapter Configure to access data specifically from Microsoft SQL Server OleDbDataAdapter Configure to access data from any database that is supported by an OLEDB data provider

2. Data Adapter cont A data adapter uses connection objects provided by the data provider to communicate with the database OleDbConnection SqlConnection Data Adapter handles data transfer between the database & the dataset through it properties and method & display the data through the process of mapping Data adapter properties and method A data adapter communicates with a database while retrieving ,inserting, deleting and updating data

Data adapter properties and method To perform various operation on database SelectCommand Refers to a SQL statement or stored procedure to retrieve data from the database InsertCommand Data command to insert data into database UpdateCommand Data command to update data into database DeleteCommand Data command to delete data into database Fill() method Fills the dataset with a records from a database Update() method Execute to corresponding insertcommand , updatecommand or deletecommand

Creating Data Adapter Three methods Through Wizard Using Server Explorer Programmatically

3. Data command A data command is an object representing a SQL statement or a stored procedure that is used to retrieve, insert, delete, modify data in a data source A data command is an object of the OleDbCommand or SQLCommand class For retrieving data through data commands, a connection object is created first to connect the database from where the data is to be retrieved.

Data command cont. Then the command object is created that refers SQL statements or procedure that is executed To access a data source , a data command should provide information about the connection for communicating with a data source Parameters that may be required for execution of the data command

Data command cont. 'Create a connection Dim cn As New SqlConnection("server=JEECOM\SQLEXPRESS;database=CustomerDB;Integrated Security=SSPI") cn.Open() Dim cmsql As SqlCommand=New SqlCommand ( "DELETE from cus where cusemp=" & Val(TextBox3.Text),cn) cmsql.ExecuteNonQuery()

Data command cont. 'Create a connection Dim cn As New SqlConnection("server=JEECOM\SQLEXPRESS;database=CustomerDB;Integrated Security=SSPI") cn.Open() Dim cmsql As New SqlCommand cmsql.Connection = cn cmsql.CommandText = "DELETE from cus where cusemp=" & Val(TextBox3.Text) cmsql.ExecuteNonQuery()  

4. Data Reader Data reader is used to retrieve data from a data source in read only and forward only mode A data reader uses connection object to connect the database The command object to execute SQL statements or procedures on the database and retrieves the data in sequential mode Using data reader results in faster access to data and less memory usage since at any time Only a single row is stored in the memory

Data Reader cont. Imports System.Data.SqlClient Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cn As New SqlConnection("server=JEECOM\SQLEXPRESS;database=Northwind;Integrated Security=SSPI") ' Create a SqlDataReader object Dim dr As SqlDataReader ' Create a new SqlCommand object Dim cmd As New SqlCommand() ' Set the Select statement in the CommandText property and ' set the Connection property to the "cn" SqlConnection object ' you just created

Data Reader cont. With cmd .CommandText = "Select CustomerID, CompanyName,ContactName from Customers" .Connection = cn End With ' Open the Connection cn.Open() ' Call the ExecuteReader method of the Command object dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) ' Call the Read method of the DataReader to loop thru the records While dr.Read ' Add the items to the ListBox1 control ListBox1.Items.Add(dr("CustomerID") & ", " & dr("CompanyName")) End While ' Close the connection cn.Close() End Sub End Class

Reference http://www.cis.usouthal.edu,2014/04/18