SlideShare ist ein Scribd-Unternehmen logo
1 von 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; />

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie Using ADO.NET Access Data

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Kürzlich hochgeladen (20)

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

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.