SlideShare une entreprise Scribd logo
1  sur  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; />

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

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
 

En vedette (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
 

Similaire à ASP.NET 09 - ADO.NET

Similaire à ASP.NET 09 - ADO.NET (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
 

Plus de Randy Connolly

Celebrating the Release of Computing Careers and Disciplines
Celebrating the Release of Computing Careers and DisciplinesCelebrating the Release of Computing Careers and Disciplines
Celebrating the Release of Computing Careers and DisciplinesRandy Connolly
 
Public Computing Intellectuals in the Age of AI Crisis
Public Computing Intellectuals in the Age of AI CrisisPublic Computing Intellectuals in the Age of AI Crisis
Public Computing Intellectuals in the Age of AI CrisisRandy Connolly
 
Why Computing Belongs Within the Social Sciences
Why Computing Belongs Within the Social SciencesWhy Computing Belongs Within the Social Sciences
Why Computing Belongs Within the Social SciencesRandy 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
 

Plus de Randy Connolly (20)

Celebrating the Release of Computing Careers and Disciplines
Celebrating the Release of Computing Careers and DisciplinesCelebrating the Release of Computing Careers and Disciplines
Celebrating the Release of Computing Careers and Disciplines
 
Public Computing Intellectuals in the Age of AI Crisis
Public Computing Intellectuals in the Age of AI CrisisPublic Computing Intellectuals in the Age of AI Crisis
Public Computing Intellectuals in the Age of AI Crisis
 
Why Computing Belongs Within the Social Sciences
Why Computing Belongs Within the Social SciencesWhy Computing Belongs Within the Social Sciences
Why Computing Belongs Within the Social Sciences
 
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
 

Dernier

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 

Dernier (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

ASP.NET 09 - ADO.NET

  • 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.