SlideShare a Scribd company logo
1 of 53
Chapter 9 Using ADO.NET
Overview ,[object Object],[object Object],[object Object],[object Object]
Introducing ADO.NET ,[object Object],[object Object],[object Object]
ADO.NET architecture
ADO.NET data providers  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ADO.NET data providers  ,[object Object],[object Object],[object Object],[object Object],[object Object]
ADO.NET namespaces
Abstract Base Classes of a Data Provider Class Description DbCommand  Executes a data command, such as a SQL statement or a stored procedure.  DbConnection  Establishes a connection to a data source.  DbDataAdapter  Populates a  DataSet  from a data source.  DbDataReader  Represents a read-only, forward-only stream of data from a data source.
ADO.NET data providers
Using Data Provider Classes ,[object Object],[object Object],[object Object],[object Object]
DBConnection ,[object Object],[object Object],[object Object]
DBConnection ,[object Object],[object Object],[object Object],[object Object]
Connection Strings ,[object Object],[object Object],[object Object],[object Object],name1=value1; name2=value Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:atabc.mdb;
Programming a DbConnection ,[object Object],[object Object],[object Object],[object Object],[object Object],// Must use @ since string contains backslash characters string connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:atabc.mdb;" OleDbConnection conn = new OleDbConnection(connString); conn.Open(); // Now use the connection … // all finished, so close connection conn.Close();
Exception Handling ,[object Object],[object Object],string connString = … OleDbConnection conn = new OleDbConnection(connString); try { conn.Open(); // Now use the connection … } catch (OleDbException ex) { // Handle or log exception } finally { if (conn != null) conn.Close(); }
Alternate Syntax ,[object Object],[object Object],[object Object],using (OleDbConnection conn = new OleDbConnection(connString)) { conn.Open(); // Now use the connection … }
Storing Connection Strings ,[object Object],<configuration> <connectionStrings> <add name=&quot;Books&quot; connectionString=&quot;Provider=…&quot; />  <add name=&quot;Sales&quot; connectionString=&quot;Data Source=…&quot; />  </connectionStrings> <system.web> … </system.web> </configuration> string connString = WebConfigurationManager.ConnectionStrings[&quot;Books&quot;].ConnectionString;
Connection Pooling ,[object Object],[object Object],[object Object],[object Object]
Connection Pooling ,[object Object],[object Object]
DbCommand ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Programming a DbCommand ,[object Object],[object Object],[object Object],string connString = &quot;…&quot; OleDbConnection conn = new OleDbConnection(connString);   // create a command using SQL text string cmdString = &quot;SELECT Id,Name,Price From Products&quot;; OleDbCommand cmd = new OleDbCommand(cmdString, conn);   conn.Open(); ...
Executing a DbCommand ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using DbParameters ,[object Object],[object Object],[object Object],[object Object]
Why String Building is Bad ,[object Object],[object Object],[object Object],[object Object],[object Object],// Do not do this string sql = &quot;SELECT * FROM Users WHERE User='&quot; + txtUser.Text + &quot;'&quot;;
SQL Injection Attack ,[object Object],[object Object],[object Object],[object Object],[object Object],string sql = &quot;SELECT * FROM Users WHERE User='&quot; + txtUser.Text + &quot;'&quot;; ' or 1=1 -- SELECT * FROM Users WHERE User='' OR 1=1 --' '; DROP TABLE customers; --
DbParameter ,[object Object],[object Object],[object Object],[object Object]
Using a DbParameter ,[object Object],[object Object],[object Object],[object Object],[object Object],SqlParameter param = new SqlParameter(&quot;@user&quot;,txtUser.Text); string s = &quot;select * from Users where UserId=@user&quot;; SqlCommand cmd; … cmd.Parameters.Add(param);
Transactions ,[object Object],[object Object],[object Object]
Local Transasctions ,[object Object]
Local Transaction Steps ,[object Object],[object Object],[object Object],[object Object],[object Object]
Distributed Transactions ,[object Object],[object Object],[object Object],[object Object],[object Object]
Distributed transactions  ,[object Object]
DbDataReader  ,[object Object],[object Object],[object Object]
Programming a DbDataReader ,[object Object],[object Object],string connString = &quot;…&quot; OleDbConnection conn = new OleDbConnection(connString);   string cmdString = &quot;SELECT Id,ProductName,Price From Products&quot;; OleDbCommand cmd = new OleDbCommand(cmdString, conn);   conn.Open(); OleDBDataReader reader = cmd.ExecuteReader();   someControl.DataSource =  reader ; someControl.DataBind();   reader.Close(); conn.Close();
Programming a DbDataReader ,[object Object],[object Object],[object Object],OleDBDataReader reader = cmd.ExecuteReader(); while ( reader.Read() ) { // process the current record } reader.Close();
Programming a DbDataReader ,[object Object],SELECT Id,ProductName,Price FROM Products // retrieve using column name int id = (int)reader[&quot;Id&quot;]; string name = (string)reader[&quot;ProductName&quot;]; double price = (double)reader[&quot;Price&quot;];   // retrieve using a zero-based column ordinal int id = (int)reader[0]; string name = (string)reader[1]; double price = (double)reader[2];   // retrieve a typed value using column ordinal int id = reader.GetInt32(0); string name = reader.GetString(1); double price = reader.GetDouble(2);
DbDataAdapter  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Programming a DbDataAdapter DataSet ds = new DataSet();   // create a connection SqlConnection conn = new SqlConnection(connString);   string sql = &quot;SELECT Isbn,Title,Price FROM Books&quot;; SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);   try { // read data into DataSet adapter.Fill(ds);   // use the filled DataSet } catch (Exception ex) { // process exception }
Data provider-independent ADO.NET coding ,[object Object],[object Object],[object Object],OleDbConnection conn = new OleDbConnection(connString); … OleDbCommand cmd = new OleDbCommand(cmdString, conn); … OleDBDataReader reader = cmd.ExecuteReader(); … SqlConnection conn = new SqlConnection(connString); … SqlCommand cmd = new SqlCommand(cmdString, conn); … SqlDataReader reader = cmd.ExecuteReader(); …
Data provider-independent ADO.NET coding ,[object Object],DbConnection  conn = new SqlConnection(connString);
Data provider-independent ADO.NET coding ,[object Object],[object Object],string invariantName = &quot;System.Data.OleDb&quot;; DbProviderFactory factory = DbProviderFactories.GetFactory(invariantName);   DbConnection conn = factory.CreateConnection(); conn.ConnectionString = connString;   DbCommand cmd = factory.CreateCommand(); cmd.CommandText = &quot;SELECT * FROM Authors&quot;; cmd.Connection = conn;
Data Source Controls ,[object Object],[object Object],[object Object],[object Object]
Data Source Controls ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using Data Source Controls ,[object Object],<asp:AccessDataSource ID=&quot; dsBooks &quot; runat=&quot;server&quot;  DataFile=&quot;App_Data/BookCatalogSystem.mdb&quot; SelectCommand=&quot;Select AuthorId,AuthorName from Authors&quot; /> <asp:DropDownList ID=&quot;drpAuthors&quot; runat=&quot;server&quot;  DataSourceID=&quot;dsBooks&quot;  DataTextField=&quot;AuthorName&quot; /> <asp:SqlDataSource ID=&quot; dsArt &quot; runat=&quot;server&quot; ConnectionString=&quot;<%$ ConnectionStrings:Books %>&quot; ProviderName=&quot;System.Data.SqlClient&quot; SelectCommand=&quot;Select AuthorId,AuthorName From Authors&quot; /> <asp:DropDownList ID=&quot;drpAuthors&quot; runat=&quot;server&quot;  DataSourceID=&quot;dsArt&quot;  DataTextField=&quot;AuthorName&quot; />
Using Parameters ,[object Object],[object Object],[object Object],<asp:SqlDataSource ID=&quot;dsArt&quot; runat=&quot;server&quot; ConnectionString=&quot;<%$ ConnectionStrings:Books %>&quot; SelectCommand=&quot;Select AuthorId,AuthorName From Authors&quot; >   <SelectParameters>   Parameter control definitions go here   </SelectParameters>   </asp:SqlDataSource>
Parameter Types ,[object Object],[object Object],[object Object],[object Object],[object Object]
Parameter Control Types ,[object Object],Property Description ControlParameter Sets the parameter value to a property value in another control on the page. CookieParameter Sets the parameter value to the value of a cookie. FormParameter Sets the parameter value to the value of a HTML form element.  ProfileParameter Sets the parameter value to the value of a property of the current user profile. QuerystringParameter Sets the parameter value to the value of a query string field. SessionParameter Sets the parameter value to the value of an object currently stored in session state.
Using Parameters <asp:DropDownList ID=&quot; drpPublisher &quot; runat=&quot;server&quot; DataSourceID=&quot;dsPublisher&quot; DataValueField=&quot;PublisherId&quot; DataTextField=&quot;PublisherName&quot; AutoPostBack=&quot;True&quot;/> … <asp:SqlDataSource ID=&quot;dsBooks&quot; runat=&quot;server&quot; ProviderName=&quot;System.Data.OleDb&quot; ConnectionString=&quot;<%$ ConnectionStrings:Catalog %>&quot; SelectCommand=&quot;SELECT ISBN, Title FROM Books WHERE  PublisherId=@Pub &quot;>   <SelectParameters> <asp:ControlParameter ControlID=&quot;drpPublisher&quot;  Name=&quot;Pub&quot; PropertyName=&quot;SelectedValue&quot; /> </SelectParameters> </asp:SqlDataSource>
How do they work? ,[object Object],[object Object],[object Object]
Data Source Control Issues ,[object Object],[object Object],[object Object],[object Object],[object Object]
Data Source Control Issues ,[object Object],[object Object],[object Object]
ObjectDataSource ,[object Object],[object Object],[object Object],[object Object],[object Object]
Using the ObjectDataSource ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<asp:ObjectDataSource ID=&quot;objCatalog&quot; runat=&quot;server&quot;  SelectMethod=&quot;GetAll&quot; TypeName=&quot;PublisherDA&quot; />

More Related Content

What's hot

Visual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetVisual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetFaRid Adwa
 
For Beginners - Ado.net
For Beginners - Ado.netFor Beginners - Ado.net
For Beginners - Ado.netTarun Jain
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentalsMadhuri Kavade
 
Database programming in vb net
Database programming in vb netDatabase programming in vb net
Database programming in vb netZishan yousaf
 
Vb.net session 05
Vb.net session 05Vb.net session 05
Vb.net session 05Niit Care
 
Dealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETDealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETFernando G. Guerrero
 
Ado.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworksAdo.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworksLuis Goldster
 
ASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And RepresentationASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And RepresentationRandy Connolly
 
Web based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverWeb based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverAmmara Arooj
 
ASP.NET Session 11 12
ASP.NET Session 11 12ASP.NET Session 11 12
ASP.NET Session 11 12Sisir Ghosh
 

What's hot (20)

ADO.NET
ADO.NETADO.NET
ADO.NET
 
Visual Basic.Net & Ado.Net
Visual Basic.Net & Ado.NetVisual Basic.Net & Ado.Net
Visual Basic.Net & Ado.Net
 
For Beginers - ADO.Net
For Beginers - ADO.NetFor Beginers - ADO.Net
For Beginers - ADO.Net
 
For Beginners - Ado.net
For Beginners - Ado.netFor Beginners - Ado.net
For Beginners - Ado.net
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
 
Chap14 ado.net
Chap14 ado.netChap14 ado.net
Chap14 ado.net
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
 
Ado.net
Ado.netAdo.net
Ado.net
 
Database programming in vb net
Database programming in vb netDatabase programming in vb net
Database programming in vb net
 
Database Connection
Database ConnectionDatabase Connection
Database Connection
 
Vb.net session 05
Vb.net session 05Vb.net session 05
Vb.net session 05
 
Dealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETDealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NET
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
 
Ado.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworksAdo.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworks
 
Ado.net
Ado.netAdo.net
Ado.net
 
Ado.net
Ado.netAdo.net
Ado.net
 
ASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And RepresentationASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And Representation
 
Web based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverWeb based database application design using vb.net and sql server
Web based database application design using vb.net and sql server
 
ASP.NET Session 11 12
ASP.NET Session 11 12ASP.NET Session 11 12
ASP.NET Session 11 12
 

Viewers also liked

ASP.NET Tutorial - Presentation 1
ASP.NET Tutorial - Presentation 1ASP.NET Tutorial - Presentation 1
ASP.NET Tutorial - Presentation 1Kumar S
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NETPeter Gfader
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notesWE-IT TUTORIALS
 
Introduction To Dotnet
Introduction To DotnetIntroduction To Dotnet
Introduction To DotnetSAMIR BHOGAYTA
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web ApplicationRishi Kothari
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NETRajkumarsoy
 
Vb net xp_05
Vb net xp_05Vb net xp_05
Vb net xp_05Niit Care
 
Ado.net session01
Ado.net session01Ado.net session01
Ado.net session01Niit Care
 
Entity framework and how to use it
Entity framework and how to use itEntity framework and how to use it
Entity framework and how to use itnspyre_net
 
Getting started with entity framework 6 code first using mvc 5
Getting started with entity framework 6 code first using mvc 5Getting started with entity framework 6 code first using mvc 5
Getting started with entity framework 6 code first using mvc 5Ehtsham Khan
 
Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Bhushan Mulmule
 
Dotnet differences compiled -1
Dotnet differences compiled -1Dotnet differences compiled -1
Dotnet differences compiled -1Umar Ali
 
05 entity framework
05 entity framework05 entity framework
05 entity frameworkglubox
 
Entity Framework and Domain Driven Design
Entity Framework and Domain Driven DesignEntity Framework and Domain Driven Design
Entity Framework and Domain Driven DesignJulie Lerman
 

Viewers also liked (18)

Asp.net.
Asp.net.Asp.net.
Asp.net.
 
ASP.NET Tutorial - Presentation 1
ASP.NET Tutorial - Presentation 1ASP.NET Tutorial - Presentation 1
ASP.NET Tutorial - Presentation 1
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
 
Introduction To Dotnet
Introduction To DotnetIntroduction To Dotnet
Introduction To Dotnet
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
Vb net xp_05
Vb net xp_05Vb net xp_05
Vb net xp_05
 
Ado.net session01
Ado.net session01Ado.net session01
Ado.net session01
 
ASP.NET y VB.NET paramanejo de base de datos
ASP.NET y VB.NET paramanejo de base de datosASP.NET y VB.NET paramanejo de base de datos
ASP.NET y VB.NET paramanejo de base de datos
 
Entity framework and how to use it
Entity framework and how to use itEntity framework and how to use it
Entity framework and how to use it
 
Getting started with entity framework 6 code first using mvc 5
Getting started with entity framework 6 code first using mvc 5Getting started with entity framework 6 code first using mvc 5
Getting started with entity framework 6 code first using mvc 5
 
Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1
 
Dotnet differences compiled -1
Dotnet differences compiled -1Dotnet differences compiled -1
Dotnet differences compiled -1
 
05 entity framework
05 entity framework05 entity framework
05 entity framework
 
Entity Framework and Domain Driven Design
Entity Framework and Domain Driven DesignEntity Framework and Domain Driven Design
Entity Framework and Domain Driven Design
 
Getting started with entity framework
Getting started with entity framework Getting started with entity framework
Getting started with entity framework
 

Similar to Using ADO.NET Access Data

Similar to Using ADO.NET Access Data (20)

Ado.Net
Ado.NetAdo.Net
Ado.Net
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studio
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studio
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to ado
 
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISPMCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
 
Unit4
Unit4Unit4
Unit4
 
Ado dot net complete meterial (1)
Ado dot net complete meterial (1)Ado dot net complete meterial (1)
Ado dot net complete meterial (1)
 
unit 3.docx
unit 3.docxunit 3.docx
unit 3.docx
 
Ado.net
Ado.netAdo.net
Ado.net
 
Csharp_dotnet_ADO_Net_database_query.pptx
Csharp_dotnet_ADO_Net_database_query.pptxCsharp_dotnet_ADO_Net_database_query.pptx
Csharp_dotnet_ADO_Net_database_query.pptx
 
Connected data classes
Connected data classesConnected data classes
Connected data classes
 
Asp.Net Database
Asp.Net DatabaseAsp.Net Database
Asp.Net Database
 
Jdbc
JdbcJdbc
Jdbc
 
B_110500002
B_110500002B_110500002
B_110500002
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
 
Mvc acchitecture
Mvc acchitectureMvc acchitecture
Mvc acchitecture
 
30 5 Database Jdbc
30 5 Database Jdbc30 5 Database Jdbc
30 5 Database Jdbc
 
JDBC.ppt
JDBC.pptJDBC.ppt
JDBC.ppt
 

More from Randy Connolly

Ten-Year Anniversary of our CIS Degree
Ten-Year Anniversary of our CIS DegreeTen-Year Anniversary of our CIS Degree
Ten-Year Anniversary of our CIS DegreeRandy Connolly
 
Careers in Computing (2019 Edition)
Careers in Computing (2019 Edition)Careers in Computing (2019 Edition)
Careers in Computing (2019 Edition)Randy Connolly
 
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...Randy Connolly
 
Where is the Internet? (2019 Edition)
Where is the Internet? (2019 Edition)Where is the Internet? (2019 Edition)
Where is the Internet? (2019 Edition)Randy Connolly
 
Modern Web Development (2018)
Modern Web Development (2018)Modern Web Development (2018)
Modern Web Development (2018)Randy Connolly
 
Helping Prospective Students Understand the Computing Disciplines
Helping Prospective Students Understand the Computing DisciplinesHelping Prospective Students Understand the Computing Disciplines
Helping Prospective Students Understand the Computing DisciplinesRandy Connolly
 
Constructing a Web Development Textbook
Constructing a Web Development TextbookConstructing a Web Development Textbook
Constructing a Web Development TextbookRandy Connolly
 
Web Development for Managers
Web Development for ManagersWeb Development for Managers
Web Development for ManagersRandy Connolly
 
Disrupting the Discourse of the "Digital Disruption of _____"
Disrupting the Discourse of the "Digital Disruption of _____"Disrupting the Discourse of the "Digital Disruption of _____"
Disrupting the Discourse of the "Digital Disruption of _____"Randy Connolly
 
17 Ways to Fail Your Courses
17 Ways to Fail Your Courses17 Ways to Fail Your Courses
17 Ways to Fail Your CoursesRandy Connolly
 
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...Randy Connolly
 
Constructing and revising a web development textbook
Constructing and revising a web development textbookConstructing and revising a web development textbook
Constructing and revising a web development textbookRandy Connolly
 
Computing is Not a Rock Band: Student Understanding of the Computing Disciplines
Computing is Not a Rock Band: Student Understanding of the Computing DisciplinesComputing is Not a Rock Band: Student Understanding of the Computing Disciplines
Computing is Not a Rock Band: Student Understanding of the Computing DisciplinesRandy Connolly
 
Citizenship: How do leaders in universities think about and experience citize...
Citizenship: How do leaders in universities think about and experience citize...Citizenship: How do leaders in universities think about and experience citize...
Citizenship: How do leaders in universities think about and experience citize...Randy Connolly
 
Thinking About Technology
Thinking About TechnologyThinking About Technology
Thinking About TechnologyRandy Connolly
 
A longitudinal examination of SIGITE conference submission data
A longitudinal examination of SIGITE conference submission dataA longitudinal examination of SIGITE conference submission data
A longitudinal examination of SIGITE conference submission dataRandy Connolly
 
Is Human Flourishing in the ICT World of the Future Likely?
Is Human Flourishing in the ICT World of the Future Likely?Is Human Flourishing in the ICT World of the Future Likely?
Is Human Flourishing in the ICT World of the Future Likely?Randy Connolly
 
Constructing a Contemporary Textbook
Constructing a Contemporary TextbookConstructing a Contemporary Textbook
Constructing a Contemporary TextbookRandy Connolly
 

More from Randy Connolly (20)

Ten-Year Anniversary of our CIS Degree
Ten-Year Anniversary of our CIS DegreeTen-Year Anniversary of our CIS Degree
Ten-Year Anniversary of our CIS Degree
 
Careers in Computing (2019 Edition)
Careers in Computing (2019 Edition)Careers in Computing (2019 Edition)
Careers in Computing (2019 Edition)
 
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
 
Where is the Internet? (2019 Edition)
Where is the Internet? (2019 Edition)Where is the Internet? (2019 Edition)
Where is the Internet? (2019 Edition)
 
Modern Web Development (2018)
Modern Web Development (2018)Modern Web Development (2018)
Modern Web Development (2018)
 
Helping Prospective Students Understand the Computing Disciplines
Helping Prospective Students Understand the Computing DisciplinesHelping Prospective Students Understand the Computing Disciplines
Helping Prospective Students Understand the Computing Disciplines
 
Constructing a Web Development Textbook
Constructing a Web Development TextbookConstructing a Web Development Textbook
Constructing a Web Development Textbook
 
Web Development for Managers
Web Development for ManagersWeb Development for Managers
Web Development for Managers
 
Disrupting the Discourse of the "Digital Disruption of _____"
Disrupting the Discourse of the "Digital Disruption of _____"Disrupting the Discourse of the "Digital Disruption of _____"
Disrupting the Discourse of the "Digital Disruption of _____"
 
17 Ways to Fail Your Courses
17 Ways to Fail Your Courses17 Ways to Fail Your Courses
17 Ways to Fail Your Courses
 
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
 
Constructing and revising a web development textbook
Constructing and revising a web development textbookConstructing and revising a web development textbook
Constructing and revising a web development textbook
 
Computing is Not a Rock Band: Student Understanding of the Computing Disciplines
Computing is Not a Rock Band: Student Understanding of the Computing DisciplinesComputing is Not a Rock Band: Student Understanding of the Computing Disciplines
Computing is Not a Rock Band: Student Understanding of the Computing Disciplines
 
Citizenship: How do leaders in universities think about and experience citize...
Citizenship: How do leaders in universities think about and experience citize...Citizenship: How do leaders in universities think about and experience citize...
Citizenship: How do leaders in universities think about and experience citize...
 
Thinking About Technology
Thinking About TechnologyThinking About Technology
Thinking About Technology
 
A longitudinal examination of SIGITE conference submission data
A longitudinal examination of SIGITE conference submission dataA longitudinal examination of SIGITE conference submission data
A longitudinal examination of SIGITE conference submission data
 
Web Security
Web SecurityWeb Security
Web Security
 
Is Human Flourishing in the ICT World of the Future Likely?
Is Human Flourishing in the ICT World of the Future Likely?Is Human Flourishing in the ICT World of the Future Likely?
Is Human Flourishing in the ICT World of the Future Likely?
 
Constructing a Contemporary Textbook
Constructing a Contemporary TextbookConstructing a Contemporary Textbook
Constructing a Contemporary Textbook
 
CSS: Introduction
CSS: IntroductionCSS: Introduction
CSS: Introduction
 

Recently uploaded

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Using ADO.NET Access Data

  • 1. Chapter 9 Using ADO.NET
  • 2.
  • 3.
  • 5.
  • 6.
  • 8. Abstract Base Classes of a Data Provider Class Description DbCommand Executes a data command, such as a SQL statement or a stored procedure. DbConnection Establishes a connection to a data source. DbDataAdapter Populates a DataSet from a data source. DbDataReader Represents a read-only, forward-only stream of data from a data source.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38. Programming a DbDataAdapter DataSet ds = new DataSet();   // create a connection SqlConnection conn = new SqlConnection(connString);   string sql = &quot;SELECT Isbn,Title,Price FROM Books&quot;; SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);   try { // read data into DataSet adapter.Fill(ds);   // use the filled DataSet } catch (Exception ex) { // process exception }
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48. Using Parameters <asp:DropDownList ID=&quot; drpPublisher &quot; runat=&quot;server&quot; DataSourceID=&quot;dsPublisher&quot; DataValueField=&quot;PublisherId&quot; DataTextField=&quot;PublisherName&quot; AutoPostBack=&quot;True&quot;/> … <asp:SqlDataSource ID=&quot;dsBooks&quot; runat=&quot;server&quot; ProviderName=&quot;System.Data.OleDb&quot; ConnectionString=&quot;<%$ ConnectionStrings:Catalog %>&quot; SelectCommand=&quot;SELECT ISBN, Title FROM Books WHERE PublisherId=@Pub &quot;>   <SelectParameters> <asp:ControlParameter ControlID=&quot;drpPublisher&quot; Name=&quot;Pub&quot; PropertyName=&quot;SelectedValue&quot; /> </SelectParameters> </asp:SqlDataSource>
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.