SlideShare a Scribd company logo
1 of 15
WELCOME
TO
ASP.NET Tutorials
on
Data Sources
• A data source control interacts with the data-bound controls and hides the complex
data binding processes. These are the tools that provide data to the data bound
controls and support execution of operations like insertions, deletions, sorting, and
updates.
• Each data source control wraps a particular data provider-relational databases, XML
documents, or custom classes and helps in:
• Managing connection
• Selecting data
• Managing presentation aspects like paging, caching, etc.
• Manipulating data
• There are many data source controls available in ASP.NET for accessing data from SQL
Server, from ODBC or OLE DB servers, from XML files, and from business objects.
• Based on type of data, these controls could be divided into two
categories:
• Hierarchical data source controls
• Table-based data source controls
• The data source controls used for hierarchical data are:
• XMLDataSource - It allows binding to XML files and strings with
or without schema information.
• SiteMapDataSource - It allows binding to a provider that supplies
site map information.
Data source controls Description
SqlDataSource It represents a connection to an ADO.NET data provider that
returns SQL data, including data sources accessible via
OLEDB and QDBC.
ObjectDataSource It allows binding to a custom .Net business object that
returns data.
LinqdataSource It allows binding to the results of a Linq-to-SQL query
(supported by ASP.NET 3.5 only).
AccessDataSource It represents connection to a Microsoft Access database.
Data Source Views
• Data source views are objects of the DataSourceView class.
Which represent a customized view of data for different
data operations such as sorting, filtering, etc.
• The DataSourceView class serves as the base class for all
data source view classes, which define the capabilities of
data source controls.
Properties Description
CanDelete Indicates whether deletion is allowed on the underlying data source.
CanInsert Indicates whether insertion is allowed on the underlying data source.
CanPage Indicates whether paging is allowed on the underlying data source.
CanRetrieveTotalRowCount Indicates whether total row count information is available.
CanSort Indicates whether the data could be sorted.
CanUpdate Indicates whether updates are allowed on the underlying data source.
Events Gets a list of event-handler delegates for the data source view.
Name Name of the view.
Methods Description
CanExecute Determines whether the specified command can be executed.
ExecuteCommand Executes the specific command.
ExecuteDelete Performs a delete operation on the list of data that the DataSourceView
object represents.
ExecuteInsert Performs an insert operation on the list of data that the DataSourceView
object represents.
ExecuteSelect Gets a list of data from the underlying data storage.
ExecuteUpdate Performs an update operation on the list of data that the DataSourceView object
represents.
Delete Performs a delete operation on the data associated with the view.
Insert Performs an insert operation on the data associated with the view.
Select Returns the queried data.
Update Performs an update operation on the data associated with the view.
OnDataSourceView
Changed
Raises the DataSourceViewChanged event.
RaiseUnsupported
CapabilitiesError
Called by the RaiseUnsupportedCapabilitiesError method to compare the capabilities
requested for an ExecuteSelect operation against those that the view supports.
The SqlDataSource Control
• The SqlDataSource control represents a connection to a relational database
such as SQL Server or Oracle database, or data accessible through OLEDB or
Open Database Connectivity (ODBC). Connection to data is made through two
important properties ConnectionString and ProviderName.
• The following code snippet provides the basic syntax of the control:
• <asp:SqlDataSource runat="server" ID="MySqlSource" ProviderName='<%$
ConnectionStrings:LocalNWind.ProviderName %>' ConnectionString='<%$
ConnectionStrings:LocalNWind %>' SelectionCommand= "SELECT * FROM
EMPLOYEES" /> <asp:GridView ID="GridView1" runat="server"
DataSourceID="MySqlSource" />
• Configuring various data operations on the underlying data depends upon the
various properties (property groups) of the data source control.
Property Group Description
DeleteCommand,
DeleteParameters,
DeleteCommandType
Gets or sets the SQL statement, parameters, and type for
deleting rows in the underlying data.
FilterExpression,
FilterParameters
Gets or sets the data filtering string and parameters.
InsertCommand,
InsertParameters,
InsertCommandType
Gets or sets the SQL statement, parameters, and type for
inserting rows in the underlying database.
SelectCommand,
SelectParameters,
SelectCommandType
Gets or sets the SQL statement, parameters, and type for retrieving
rows from the underlying database.
SortParameterName Gets or sets the name of an input parameter that the command's
stored procedure will use to sort data.
UpdateCommand,
UpdateParameters,
UpdateCommandType
Gets or sets the SQL statement, parameters, and type for updating
rows in the underlying data store.
The ObjectDataSource Control
• The ObjectDataSource Control enables user-defined classes to associate the
output of their methods to data bound controls. The programming interface
of this class is almost same as the SqlDataSource control.
• Following are two important aspects of binding business objects:
• The bindable class should have a default constructor, it should be stateless,
and have methods that can be mapped to select, update, insert, and delete
semantics.
• The object must update one item at a time, batch operations are not
supported.
• Let us go directly to an example to work with this control. The student class is
the class to be used with an object data source. This class has three
properties: a student id, name, and city. It has a default constructor and a
GetStudents method for retrieving data.
The AccessDataSource Control
• The AccessDataSource control represents a connection to an Access database. It is
based on the SqlDataSource control and provides simpler programming interface.
The following code snippet provides the basic syntax for the data source:
• <asp:AccessDataSource ID="AccessDataSource1 runat="server"
DataFile="~/App_Data/ASPDotNetStepByStep.mdb" SelectCommand="SELECT *
FROM [DotNetReferences]"> </asp:AccessDataSource>
• The AccessDataSource control opens the database in read-only mode. However, it
can also be used for performing insert, update, or delete operations. This is done
using the ADO.NET commands and parameter collection.
• Updates are problematic for Access databases from within an ASP.NET application
because an Access database is a plain file and the default account of the ASP.NET
application might not have the permission to write to the database file.
Thank You
For more updates on C#, ASP.NET, MVC, JAVASCRIPT, HTML,
CSS tutorials subscribe to our YouTube channel
SIRYMEDIA
Visit our website for more
www.sirymedia.in

More Related Content

What's hot

What's hot (20)

Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Introduction to HTML5 Canvas
Introduction to HTML5 CanvasIntroduction to HTML5 Canvas
Introduction to HTML5 Canvas
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
form view
form viewform view
form view
 
Database user and administrator.pptx
Database user and administrator.pptxDatabase user and administrator.pptx
Database user and administrator.pptx
 
Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHP
 
WSDL
WSDLWSDL
WSDL
 
Data controls ppt
Data controls pptData controls ppt
Data controls ppt
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
View of data DBMS
View of data DBMSView of data DBMS
View of data DBMS
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Server Side Programming
Server Side ProgrammingServer Side Programming
Server Side Programming
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
Ajax ppt - 32 slides
Ajax ppt - 32 slidesAjax ppt - 32 slides
Ajax ppt - 32 slides
 

Viewers also liked

Refrigerios Inicial Huancavelica
Refrigerios Inicial HuancavelicaRefrigerios Inicial Huancavelica
Refrigerios Inicial HuancavelicaGerson Ames
 
autsourcing y emporwenmet
autsourcing y emporwenmetautsourcing y emporwenmet
autsourcing y emporwenmetAndris Prieto
 
Rubber & Tyre Machinery World - Collectors Edition - Dec 2015
Rubber & Tyre Machinery World - Collectors Edition - Dec 2015Rubber & Tyre Machinery World - Collectors Edition - Dec 2015
Rubber & Tyre Machinery World - Collectors Edition - Dec 2015Rubber & Tyre Machinery World
 
C - Retread Procedures for Commercial Tires
C - Retread Procedures for Commercial TiresC - Retread Procedures for Commercial Tires
C - Retread Procedures for Commercial TiresRobert McElroy
 
Custom control in asp.net
Custom control in asp.netCustom control in asp.net
Custom control in asp.netSireesh K
 
El ciclo vital de una iglesia
El ciclo vital de una iglesiaEl ciclo vital de una iglesia
El ciclo vital de una iglesiaPablo A. Jimenez
 
Balance Of Power
Balance Of PowerBalance Of Power
Balance Of PowerAnas ali
 

Viewers also liked (13)

Refrigerios Inicial Huancavelica
Refrigerios Inicial HuancavelicaRefrigerios Inicial Huancavelica
Refrigerios Inicial Huancavelica
 
autsourcing y emporwenmet
autsourcing y emporwenmetautsourcing y emporwenmet
autsourcing y emporwenmet
 
Three Little Kids
Three Little KidsThree Little Kids
Three Little Kids
 
Escritorio remoto
Escritorio remoto Escritorio remoto
Escritorio remoto
 
Rubber & Tyre Machinery World - Collectors Edition - Dec 2015
Rubber & Tyre Machinery World - Collectors Edition - Dec 2015Rubber & Tyre Machinery World - Collectors Edition - Dec 2015
Rubber & Tyre Machinery World - Collectors Edition - Dec 2015
 
C - Retread Procedures for Commercial Tires
C - Retread Procedures for Commercial TiresC - Retread Procedures for Commercial Tires
C - Retread Procedures for Commercial Tires
 
Clase 10 SPSS
Clase 10 SPSSClase 10 SPSS
Clase 10 SPSS
 
Rubber calenders at a glance
Rubber calenders at a glanceRubber calenders at a glance
Rubber calenders at a glance
 
3. regimen tributario aduanero peru 1
3.  regimen tributario aduanero peru 13.  regimen tributario aduanero peru 1
3. regimen tributario aduanero peru 1
 
Custom control in asp.net
Custom control in asp.netCustom control in asp.net
Custom control in asp.net
 
The Art of Owning & Operating Rubber Calenders
The Art of Owning & Operating Rubber CalendersThe Art of Owning & Operating Rubber Calenders
The Art of Owning & Operating Rubber Calenders
 
El ciclo vital de una iglesia
El ciclo vital de una iglesiaEl ciclo vital de una iglesia
El ciclo vital de una iglesia
 
Balance Of Power
Balance Of PowerBalance Of Power
Balance Of Power
 

Similar to Datasource in asp.net

WEB PROGRAMMING USING ASP.NET
WEB PROGRAMMING USING ASP.NETWEB PROGRAMMING USING ASP.NET
WEB PROGRAMMING USING ASP.NETDhruvVekariya3
 
Asp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptxAsp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptxsridharu1981
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentalsMadhuri Kavade
 
Databind in asp.net
Databind in asp.netDatabind in asp.net
Databind in asp.netSireesh K
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to adoHarman Bajwa
 
Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desaijmsthakur
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NETrchakra
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net ArchitectureUmar Farooq
 
(ATS3-PLAT04) Database Connectivity for Application Development
(ATS3-PLAT04) Database Connectivity for Application Development(ATS3-PLAT04) Database Connectivity for Application Development
(ATS3-PLAT04) Database Connectivity for Application DevelopmentBIOVIA
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actionsAren Zomorodian
 

Similar to Datasource in asp.net (20)

Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
 
WEB PROGRAMMING USING ASP.NET
WEB PROGRAMMING USING ASP.NETWEB PROGRAMMING USING ASP.NET
WEB PROGRAMMING USING ASP.NET
 
Asp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptxAsp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptx
 
ASP.NET Lecture 4
ASP.NET Lecture 4ASP.NET Lecture 4
ASP.NET Lecture 4
 
ADO.NET by ASP.NET Development Company in india
ADO.NET by ASP.NET  Development Company in indiaADO.NET by ASP.NET  Development Company in india
ADO.NET by ASP.NET Development Company in india
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
 
ADO.net control
ADO.net controlADO.net control
ADO.net control
 
Databind in asp.net
Databind in asp.netDatabind in asp.net
Databind in asp.net
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to ado
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
 
Ado.net
Ado.netAdo.net
Ado.net
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
 
Marmagna desai
Marmagna desaiMarmagna desai
Marmagna desai
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NET
 
PPT temp.pptx
PPT temp.pptxPPT temp.pptx
PPT temp.pptx
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
(ATS3-PLAT04) Database Connectivity for Application Development
(ATS3-PLAT04) Database Connectivity for Application Development(ATS3-PLAT04) Database Connectivity for Application Development
(ATS3-PLAT04) Database Connectivity for Application Development
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actions
 
Ado
AdoAdo
Ado
 

More from Sireesh K (20)

Cn10
Cn10Cn10
Cn10
 
chanakya neeti
chanakya neetichanakya neeti
chanakya neeti
 
chanakya neeti
chanakya neetichanakya neeti
chanakya neeti
 
What is mvc
What is mvcWhat is mvc
What is mvc
 
31c
31c31c
31c
 
31cs
31cs31cs
31cs
 
45c
45c45c
45c
 
44c
44c44c
44c
 
43c
43c43c
43c
 
42c
42c42c
42c
 
41c
41c41c
41c
 
40c
40c40c
40c
 
39c
39c39c
39c
 
38c
38c38c
38c
 
37c
37c37c
37c
 
35c
35c35c
35c
 
34c
34c34c
34c
 
33c
33c33c
33c
 
30c
30c30c
30c
 
29c
29c29c
29c
 

Recently uploaded

Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 

Recently uploaded (20)

Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 

Datasource in asp.net

  • 3. • A data source control interacts with the data-bound controls and hides the complex data binding processes. These are the tools that provide data to the data bound controls and support execution of operations like insertions, deletions, sorting, and updates. • Each data source control wraps a particular data provider-relational databases, XML documents, or custom classes and helps in: • Managing connection • Selecting data • Managing presentation aspects like paging, caching, etc. • Manipulating data • There are many data source controls available in ASP.NET for accessing data from SQL Server, from ODBC or OLE DB servers, from XML files, and from business objects.
  • 4. • Based on type of data, these controls could be divided into two categories: • Hierarchical data source controls • Table-based data source controls • The data source controls used for hierarchical data are: • XMLDataSource - It allows binding to XML files and strings with or without schema information. • SiteMapDataSource - It allows binding to a provider that supplies site map information.
  • 5. Data source controls Description SqlDataSource It represents a connection to an ADO.NET data provider that returns SQL data, including data sources accessible via OLEDB and QDBC. ObjectDataSource It allows binding to a custom .Net business object that returns data. LinqdataSource It allows binding to the results of a Linq-to-SQL query (supported by ASP.NET 3.5 only). AccessDataSource It represents connection to a Microsoft Access database.
  • 6. Data Source Views • Data source views are objects of the DataSourceView class. Which represent a customized view of data for different data operations such as sorting, filtering, etc. • The DataSourceView class serves as the base class for all data source view classes, which define the capabilities of data source controls.
  • 7. Properties Description CanDelete Indicates whether deletion is allowed on the underlying data source. CanInsert Indicates whether insertion is allowed on the underlying data source. CanPage Indicates whether paging is allowed on the underlying data source. CanRetrieveTotalRowCount Indicates whether total row count information is available. CanSort Indicates whether the data could be sorted. CanUpdate Indicates whether updates are allowed on the underlying data source. Events Gets a list of event-handler delegates for the data source view. Name Name of the view.
  • 8. Methods Description CanExecute Determines whether the specified command can be executed. ExecuteCommand Executes the specific command. ExecuteDelete Performs a delete operation on the list of data that the DataSourceView object represents. ExecuteInsert Performs an insert operation on the list of data that the DataSourceView object represents. ExecuteSelect Gets a list of data from the underlying data storage.
  • 9. ExecuteUpdate Performs an update operation on the list of data that the DataSourceView object represents. Delete Performs a delete operation on the data associated with the view. Insert Performs an insert operation on the data associated with the view. Select Returns the queried data. Update Performs an update operation on the data associated with the view. OnDataSourceView Changed Raises the DataSourceViewChanged event. RaiseUnsupported CapabilitiesError Called by the RaiseUnsupportedCapabilitiesError method to compare the capabilities requested for an ExecuteSelect operation against those that the view supports.
  • 10. The SqlDataSource Control • The SqlDataSource control represents a connection to a relational database such as SQL Server or Oracle database, or data accessible through OLEDB or Open Database Connectivity (ODBC). Connection to data is made through two important properties ConnectionString and ProviderName. • The following code snippet provides the basic syntax of the control: • <asp:SqlDataSource runat="server" ID="MySqlSource" ProviderName='<%$ ConnectionStrings:LocalNWind.ProviderName %>' ConnectionString='<%$ ConnectionStrings:LocalNWind %>' SelectionCommand= "SELECT * FROM EMPLOYEES" /> <asp:GridView ID="GridView1" runat="server" DataSourceID="MySqlSource" /> • Configuring various data operations on the underlying data depends upon the various properties (property groups) of the data source control.
  • 11. Property Group Description DeleteCommand, DeleteParameters, DeleteCommandType Gets or sets the SQL statement, parameters, and type for deleting rows in the underlying data. FilterExpression, FilterParameters Gets or sets the data filtering string and parameters. InsertCommand, InsertParameters, InsertCommandType Gets or sets the SQL statement, parameters, and type for inserting rows in the underlying database.
  • 12. SelectCommand, SelectParameters, SelectCommandType Gets or sets the SQL statement, parameters, and type for retrieving rows from the underlying database. SortParameterName Gets or sets the name of an input parameter that the command's stored procedure will use to sort data. UpdateCommand, UpdateParameters, UpdateCommandType Gets or sets the SQL statement, parameters, and type for updating rows in the underlying data store.
  • 13. The ObjectDataSource Control • The ObjectDataSource Control enables user-defined classes to associate the output of their methods to data bound controls. The programming interface of this class is almost same as the SqlDataSource control. • Following are two important aspects of binding business objects: • The bindable class should have a default constructor, it should be stateless, and have methods that can be mapped to select, update, insert, and delete semantics. • The object must update one item at a time, batch operations are not supported. • Let us go directly to an example to work with this control. The student class is the class to be used with an object data source. This class has three properties: a student id, name, and city. It has a default constructor and a GetStudents method for retrieving data.
  • 14. The AccessDataSource Control • The AccessDataSource control represents a connection to an Access database. It is based on the SqlDataSource control and provides simpler programming interface. The following code snippet provides the basic syntax for the data source: • <asp:AccessDataSource ID="AccessDataSource1 runat="server" DataFile="~/App_Data/ASPDotNetStepByStep.mdb" SelectCommand="SELECT * FROM [DotNetReferences]"> </asp:AccessDataSource> • The AccessDataSource control opens the database in read-only mode. However, it can also be used for performing insert, update, or delete operations. This is done using the ADO.NET commands and parameter collection. • Updates are problematic for Access databases from within an ASP.NET application because an Access database is a plain file and the default account of the ASP.NET application might not have the permission to write to the database file.
  • 15. Thank You For more updates on C#, ASP.NET, MVC, JAVASCRIPT, HTML, CSS tutorials subscribe to our YouTube channel SIRYMEDIA Visit our website for more www.sirymedia.in