SlideShare a Scribd company logo
Developing Windows and Web Applications using Visual Studio.NET Eric Phan Solution Architect
Homework? ,[object Object]
Credit Card Validation,[object Object]
Recap
1 2
Session 7: Data in the Web ,[object Object]
Old Style
New Style
DataBinding
DataGrid
Input Validation,[object Object]
Data
Bring database to the web Show/view Data Enter
OLD way
What is ADO.NET?  Set of classes that expose data access services to the .NET programmer ADO.NET provides a rich set of components for creating distributed, data-sharing applications It is an integral part of the .NET Framework, providing access to relational data, XML, and application data
WebForm Apps WinForm Apps ADO.NET DataSets SQLConnection SQLCommand SQLDataAdapter SQLDataReader SQL Data Providers SQL Data XML Data Oracle Data …
Objects Instead of DataSets we use classes Extensible Can embed logic and validation A more OO approach
WebForm Apps WinForm Apps Objects/Entities Data Sources SQL Data XML Data Oracle Data …
DataSets or Business Objects Why use DataSets A highly functional container for data that can be strongly typed Automatic change tracking for contained data Seamless data-binding support Why Use Objects Business Objects (NHibernate, NTiers, LINQ to SQL, LINQ to Entities) Light weight Good data-binding support Extensible and OO Very easy to use No SQL command Strings
The new way!LINQ 2 EntitiesLINQ 2 SQL
LINQ to SQL/Entities Brand new in the .NET 3.5 Framework Easily access and query your database through classes Logical access to class hierarchies Supports Inheritance Intuitive to use
DBML File Database Mapping Language Contains a mapping of classes to database tables Has built in logic to handle selection, updates and deletes Can be customized www.hookedonlinq.com
var customers = 	from c in db.Customers 			where c.FirstName.StartsWith(“A”)		select c SQL Syntax
var  customers = db.Customers.Where(c => c.FirstName.StartsWith(“A”); Lambda Syntax
Challenge, use this instead of SQL Server Management Studio for a month LINQPad
See our Rules http://www.ssw.com.au/ssw/Standards/Rules/RulesToBetterLINQ.aspx
Databinding
Bind the data Data Data source
Data Binding Data Data source From MSDN: Data binding is the process that establishes connection between the application UI and business logic Binding controls to data from database Bind a grid on Webform to a database table Simple, convenient, and powerful way to create a read/write link between the controls on a form and the data in their application
Databinding the GridView (code) C# NorthwindDataContext db = newNorthwindDataContext(); GridView1.DataSource = db.Customers; GridView1.DataBind(); English  Instantiate our data access class Make the datasource of GridView1 all the customers from our database Bind the Grid
Databinding the GridView (designer)
Databinding the GridView (designer)
Databinding the GridView (designer)
Databinding the GridView (designer)
Databinding the GridView (designer)
Databinding the GridView (running)
GridView ,[object Object]
Display a Table from a Database
Easy to configure
Without writing any code at all,[object Object]
Enabling these features Enable Delete, Insert, Update on the DataSource
Enabling these features Enable them on the GridView
Easy!
Other Data Bindable Web Controls Bindable to Lists  DataList DetailsView FormView Repeater/ListView DropDownList ListBox CheckBoxList RadioButtonList Bindable to Properties/Columns Most other controls
Data-Bound Controls Most controls in .NET Framework support data binding Controls inherit from the WebControl base classwhich implements IDataBindingsAccessorinterface Important Data-binding properties  DataSource DataMember DisplayMember ValueMember Design your own controls or purchase 3rd party controls
Passing Parameters
Passing Parameters between pages Pass parameters to pages or controls Pass parameters to our data sources Parameters can be obtained from: Query String Session Variable Control Property Hidden Field Cookie
1. Create a CustomerDetails.aspx  Add a Details View and create a new Datasource
2. Create a LINQ Data Source
3. Specify the Where clause
4. Make it read from the Query String
5. Change the Select on the GridView to Link to the CustomerDetails Page
6. Edit the templates
7. Delete Select and Add a Hyperlink
8. Configure the Hyperlink CustomerDetails.aspx?CustomerID={0}
Run it
Validation – Don’t trust anyone
Validation - Bring database to the web Show/view Data Enter
Validation Why do we need it? PEBCAC Bad Data
Input Validation
Why use Validations? Seamless verification of data fields Check for mandatory fields Check for correct data formats Check for data ranges Reduces incorrect data entered into your database Prevent possible runtime exceptions
Validation Types Client Show/view Data Enter Client Server
Validation Types Client-Side Validation Validations are performed before the form is posted back Quick and responsive for the end user Insecure Server-Side Validation Validation checks are performed on the server Secure because these checks cannot be easily by passed Sometimes can be slow Recommendation Use both the types This approach provides the best of both worlds Client Show/view Data Enter Client Server
ASP.NET Validation Server Controls RequiredFieldValidator CompareValidator RangeValidator RegularExpressionValidator CustomValidator ValidationSummary
To put the Northwind database up on the web? CRUD for all tables Pages for all tables Validation	 So how long do you think it would take...
1 line of code 5 Minutes

More Related Content

What's hot

Design mission-critical enterprise applications with Power Automate and Docto...
Design mission-critical enterprise applications with Power Automate and Docto...Design mission-critical enterprise applications with Power Automate and Docto...
Design mission-critical enterprise applications with Power Automate and Docto...
serge luca
 
Mostafa Elzoghbi: SharePoint 2010 Sandbox Solutions Best Practices
Mostafa Elzoghbi: SharePoint 2010 Sandbox Solutions Best PracticesMostafa Elzoghbi: SharePoint 2010 Sandbox Solutions Best Practices
Mostafa Elzoghbi: SharePoint 2010 Sandbox Solutions Best PracticesSharePoint Saturday NY
 
Spring tutorials
Spring tutorialsSpring tutorials
Spring tutorials
TIB Academy
 
Sydney SPUG - February 2014 - Pitfalls of Migrating to SharePoint 2013
Sydney SPUG - February 2014 - Pitfalls of Migrating to SharePoint 2013 Sydney SPUG - February 2014 - Pitfalls of Migrating to SharePoint 2013
Sydney SPUG - February 2014 - Pitfalls of Migrating to SharePoint 2013
Scott Hoag
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchRob Windsor
 
SPS Belgium 2015 - High-trust Apps for On-Premises Development
SPS Belgium 2015 -  High-trust Apps for On-Premises DevelopmentSPS Belgium 2015 -  High-trust Apps for On-Premises Development
SPS Belgium 2015 - High-trust Apps for On-Premises Development
Edin Kapic
 
Greg Hurlman: Developing Custom Service Applications
Greg Hurlman: Developing Custom Service ApplicationsGreg Hurlman: Developing Custom Service Applications
Greg Hurlman: Developing Custom Service ApplicationsSharePoint Saturday NY
 
The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)
Jay Simcox
 
Microsoft AZ-204 Exam Dumps
Microsoft AZ-204 Exam DumpsMicrosoft AZ-204 Exam Dumps
Microsoft AZ-204 Exam Dumps
Study Material
 
Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...
Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...
Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...
Vincent Biret
 
Mule microsoft
Mule  microsoftMule  microsoft
Mule microsoft
D.Rajesh Kumar
 
Integrate mule esb with microsoft office 365 share point
Integrate mule esb with microsoft office 365 share pointIntegrate mule esb with microsoft office 365 share point
Integrate mule esb with microsoft office 365 share point
sivachandra mandalapu
 
Microsoft Graph developer community call-March 2020
Microsoft Graph developer community call-March 2020Microsoft Graph developer community call-March 2020
Microsoft Graph developer community call-March 2020
Microsoft 365 Developer
 
Whats New In Asp.Net Web Forms 4
Whats New In Asp.Net Web Forms 4Whats New In Asp.Net Web Forms 4
Whats New In Asp.Net Web Forms 4
Rishu Mehra
 
Rencore Power Automate Mini Summit : Power Automate Business Process Manageme...
Rencore Power Automate Mini Summit : Power Automate Business Process Manageme...Rencore Power Automate Mini Summit : Power Automate Business Process Manageme...
Rencore Power Automate Mini Summit : Power Automate Business Process Manageme...
serge luca
 
An introduction to Microsoft Graph for developers
An introduction to Microsoft Graph for developersAn introduction to Microsoft Graph for developers
An introduction to Microsoft Graph for developers
Microsoft 365 Developer
 
Work experiences at Softcodeit
Work experiences at SoftcodeitWork experiences at Softcodeit
Work experiences at SoftcodeitVayodya Tamari
 
Using microsoft flow in real world projects 2 years later and what's next
Using microsoft flow in real world projects 2 years later and what's nextUsing microsoft flow in real world projects 2 years later and what's next
Using microsoft flow in real world projects 2 years later and what's next
serge luca
 
SharePoint 2013 and ADFS
SharePoint 2013 and ADFSSharePoint 2013 and ADFS
SharePoint 2013 and ADFS
Natallia Makarevich
 

What's hot (20)

Design mission-critical enterprise applications with Power Automate and Docto...
Design mission-critical enterprise applications with Power Automate and Docto...Design mission-critical enterprise applications with Power Automate and Docto...
Design mission-critical enterprise applications with Power Automate and Docto...
 
Mostafa Elzoghbi: SharePoint 2010 Sandbox Solutions Best Practices
Mostafa Elzoghbi: SharePoint 2010 Sandbox Solutions Best PracticesMostafa Elzoghbi: SharePoint 2010 Sandbox Solutions Best Practices
Mostafa Elzoghbi: SharePoint 2010 Sandbox Solutions Best Practices
 
Spring tutorials
Spring tutorialsSpring tutorials
Spring tutorials
 
Sydney SPUG - February 2014 - Pitfalls of Migrating to SharePoint 2013
Sydney SPUG - February 2014 - Pitfalls of Migrating to SharePoint 2013 Sydney SPUG - February 2014 - Pitfalls of Migrating to SharePoint 2013
Sydney SPUG - February 2014 - Pitfalls of Migrating to SharePoint 2013
 
Integrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio LightswitchIntegrating SharePoint 2010 and Visual Studio Lightswitch
Integrating SharePoint 2010 and Visual Studio Lightswitch
 
SPS Belgium 2015 - High-trust Apps for On-Premises Development
SPS Belgium 2015 -  High-trust Apps for On-Premises DevelopmentSPS Belgium 2015 -  High-trust Apps for On-Premises Development
SPS Belgium 2015 - High-trust Apps for On-Premises Development
 
Greg Hurlman: Developing Custom Service Applications
Greg Hurlman: Developing Custom Service ApplicationsGreg Hurlman: Developing Custom Service Applications
Greg Hurlman: Developing Custom Service Applications
 
The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)The Who, What, Why and How of Active Directory Federation Services (AD FS)
The Who, What, Why and How of Active Directory Federation Services (AD FS)
 
Microsoft AZ-204 Exam Dumps
Microsoft AZ-204 Exam DumpsMicrosoft AZ-204 Exam Dumps
Microsoft AZ-204 Exam Dumps
 
Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...
Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...
Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...
 
Mule microsoft
Mule  microsoftMule  microsoft
Mule microsoft
 
Integrate mule esb with microsoft office 365 share point
Integrate mule esb with microsoft office 365 share pointIntegrate mule esb with microsoft office 365 share point
Integrate mule esb with microsoft office 365 share point
 
Microsoft Graph developer community call-March 2020
Microsoft Graph developer community call-March 2020Microsoft Graph developer community call-March 2020
Microsoft Graph developer community call-March 2020
 
Whats New In Asp.Net Web Forms 4
Whats New In Asp.Net Web Forms 4Whats New In Asp.Net Web Forms 4
Whats New In Asp.Net Web Forms 4
 
Rencore Power Automate Mini Summit : Power Automate Business Process Manageme...
Rencore Power Automate Mini Summit : Power Automate Business Process Manageme...Rencore Power Automate Mini Summit : Power Automate Business Process Manageme...
Rencore Power Automate Mini Summit : Power Automate Business Process Manageme...
 
An introduction to Microsoft Graph for developers
An introduction to Microsoft Graph for developersAn introduction to Microsoft Graph for developers
An introduction to Microsoft Graph for developers
 
mini_Project_SRS
mini_Project_SRSmini_Project_SRS
mini_Project_SRS
 
Work experiences at Softcodeit
Work experiences at SoftcodeitWork experiences at Softcodeit
Work experiences at Softcodeit
 
Using microsoft flow in real world projects 2 years later and what's next
Using microsoft flow in real world projects 2 years later and what's nextUsing microsoft flow in real world projects 2 years later and what's next
Using microsoft flow in real world projects 2 years later and what's next
 
SharePoint 2013 and ADFS
SharePoint 2013 and ADFSSharePoint 2013 and ADFS
SharePoint 2013 and ADFS
 

Viewers also liked

Asp.net new
Asp.net newAsp.net new
Asp.net new
Ganesh Jaya
 
ASP.NET 01 - Introduction
ASP.NET 01 - IntroductionASP.NET 01 - Introduction
ASP.NET 01 - Introduction
Randy Connolly
 
Better User Experience with .NET
Better User Experience with .NETBetter User Experience with .NET
Better User Experience with .NET
Peter Gfader
 
N-Tier Application with Windows Forms - Deployment and Security
N-Tier Application with Windows Forms - Deployment and SecurityN-Tier Application with Windows Forms - Deployment and Security
N-Tier Application with Windows Forms - Deployment and Security
Peter Gfader
 
Web Service
Web ServiceWeb Service
Web Service
Kumar S
 
Structured Process Of Developing A Web Application
Structured Process Of Developing A Web ApplicationStructured Process Of Developing A Web Application
Structured Process Of Developing A Web Application
Kumar S
 
SQL Server - Introduction to TSQL
SQL Server - Introduction to TSQLSQL Server - Introduction to TSQL
SQL Server - Introduction to TSQLPeter Gfader
 

Viewers also liked (7)

Asp.net new
Asp.net newAsp.net new
Asp.net new
 
ASP.NET 01 - Introduction
ASP.NET 01 - IntroductionASP.NET 01 - Introduction
ASP.NET 01 - Introduction
 
Better User Experience with .NET
Better User Experience with .NETBetter User Experience with .NET
Better User Experience with .NET
 
N-Tier Application with Windows Forms - Deployment and Security
N-Tier Application with Windows Forms - Deployment and SecurityN-Tier Application with Windows Forms - Deployment and Security
N-Tier Application with Windows Forms - Deployment and Security
 
Web Service
Web ServiceWeb Service
Web Service
 
Structured Process Of Developing A Web Application
Structured Process Of Developing A Web ApplicationStructured Process Of Developing A Web Application
Structured Process Of Developing A Web Application
 
SQL Server - Introduction to TSQL
SQL Server - Introduction to TSQLSQL Server - Introduction to TSQL
SQL Server - Introduction to TSQL
 

Similar to Work with data in ASP.NET

ASP.NET MVC Reading July 2009
ASP.NET MVC Reading July 2009ASP.NET MVC Reading July 2009
ASP.NET MVC Reading July 2009
ukdpe
 
ASP.NET Lecture 4
ASP.NET Lecture 4ASP.NET Lecture 4
ASP.NET Lecture 4
Julie Iskander
 
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Sparkhound Inc.
 
How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?
AmeliaWong21
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
Volkan Uzun
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08Mani Chaubey
 
5. iED Cloud Services.pdf
5. iED Cloud Services.pdf5. iED Cloud Services.pdf
5. iED Cloud Services.pdf
ssuser905b17
 
Easy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsEasy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applications
Jack-Junjie Cai
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
Vivek chan
 
Put Your Existing Application On Windows Azure
Put Your Existing Application On Windows AzurePut Your Existing Application On Windows Azure
Put Your Existing Application On Windows Azure
Maarten Balliauw
 
Introduction To Sql Services
Introduction To Sql ServicesIntroduction To Sql Services
Introduction To Sql Services
llangit
 
Connect Remotely Using Windows® 7 Direct Access
Connect Remotely Using Windows® 7 Direct AccessConnect Remotely Using Windows® 7 Direct Access
Connect Remotely Using Windows® 7 Direct Access
Microsoft TechNet
 
Primavera integration possibilities Technical overview - Oracle Primavera Col...
Primavera integration possibilities Technical overview - Oracle Primavera Col...Primavera integration possibilities Technical overview - Oracle Primavera Col...
Primavera integration possibilities Technical overview - Oracle Primavera Col...
p6academy
 
Access Apps for Office 365 with Power BI
Access Apps for Office 365 with Power BIAccess Apps for Office 365 with Power BI
Access Apps for Office 365 with Power BI
Chris McNulty
 
.NET RIA Services Architecture Overview
.NET RIA Services Architecture Overview .NET RIA Services Architecture Overview
.NET RIA Services Architecture Overview
brada
 
Emergent architecture- a casestudy TREDS
Emergent architecture- a casestudy TREDSEmergent architecture- a casestudy TREDS
Emergent architecture- a casestudy TREDS
Syed Rayhan
 
Real World API Design Using The Entity Framework Services
Real World API Design Using The Entity Framework ServicesReal World API Design Using The Entity Framework Services
Real World API Design Using The Entity Framework Services
David McCarter
 
J2EE pattern 5
J2EE pattern 5J2EE pattern 5
J2EE pattern 5
Naga Muruga
 
ASP.NET-stored procedure-manual
ASP.NET-stored procedure-manualASP.NET-stored procedure-manual

Similar to Work with data in ASP.NET (20)

ASP.NET MVC Reading July 2009
ASP.NET MVC Reading July 2009ASP.NET MVC Reading July 2009
ASP.NET MVC Reading July 2009
 
ASP.NET Lecture 4
ASP.NET Lecture 4ASP.NET Lecture 4
ASP.NET Lecture 4
 
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
Optimizing Code Reusability for SharePoint using Linq to SharePoint & the MVP...
 
How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 
5. iED Cloud Services.pdf
5. iED Cloud Services.pdf5. iED Cloud Services.pdf
5. iED Cloud Services.pdf
 
Easy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsEasy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applications
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 
Put Your Existing Application On Windows Azure
Put Your Existing Application On Windows AzurePut Your Existing Application On Windows Azure
Put Your Existing Application On Windows Azure
 
B_110500002
B_110500002B_110500002
B_110500002
 
Introduction To Sql Services
Introduction To Sql ServicesIntroduction To Sql Services
Introduction To Sql Services
 
Connect Remotely Using Windows® 7 Direct Access
Connect Remotely Using Windows® 7 Direct AccessConnect Remotely Using Windows® 7 Direct Access
Connect Remotely Using Windows® 7 Direct Access
 
Primavera integration possibilities Technical overview - Oracle Primavera Col...
Primavera integration possibilities Technical overview - Oracle Primavera Col...Primavera integration possibilities Technical overview - Oracle Primavera Col...
Primavera integration possibilities Technical overview - Oracle Primavera Col...
 
Access Apps for Office 365 with Power BI
Access Apps for Office 365 with Power BIAccess Apps for Office 365 with Power BI
Access Apps for Office 365 with Power BI
 
.NET RIA Services Architecture Overview
.NET RIA Services Architecture Overview .NET RIA Services Architecture Overview
.NET RIA Services Architecture Overview
 
Emergent architecture- a casestudy TREDS
Emergent architecture- a casestudy TREDSEmergent architecture- a casestudy TREDS
Emergent architecture- a casestudy TREDS
 
Real World API Design Using The Entity Framework Services
Real World API Design Using The Entity Framework ServicesReal World API Design Using The Entity Framework Services
Real World API Design Using The Entity Framework Services
 
J2EE pattern 5
J2EE pattern 5J2EE pattern 5
J2EE pattern 5
 
ASP.NET-stored procedure-manual
ASP.NET-stored procedure-manualASP.NET-stored procedure-manual
ASP.NET-stored procedure-manual
 

More from Peter Gfader

Achieving Technical Excellence in Your Software Teams - from Devternity
Achieving Technical Excellence in Your Software Teams - from Devternity Achieving Technical Excellence in Your Software Teams - from Devternity
Achieving Technical Excellence in Your Software Teams - from Devternity
Peter Gfader
 
You Can't Be Agile If Your Testing Practices Suck - Vilnius October 2019
You Can't Be Agile If Your Testing Practices Suck - Vilnius October 2019You Can't Be Agile If Your Testing Practices Suck - Vilnius October 2019
You Can't Be Agile If Your Testing Practices Suck - Vilnius October 2019
Peter Gfader
 
You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)
You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)
You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)
Peter Gfader
 
How to make more impact as an engineer
How to make more impact as an engineerHow to make more impact as an engineer
How to make more impact as an engineer
Peter Gfader
 
13 explosive things you should try as an agilist
13 explosive things you should try as an agilist13 explosive things you should try as an agilist
13 explosive things you should try as an agilist
Peter Gfader
 
You cant be agile if your code sucks
You cant be agile if your code sucksYou cant be agile if your code sucks
You cant be agile if your code sucks
Peter Gfader
 
Use Scrum and Continuous Delivery to innovate like crazy!
Use Scrum and Continuous Delivery to innovate like crazy!Use Scrum and Continuous Delivery to innovate like crazy!
Use Scrum and Continuous Delivery to innovate like crazy!
Peter Gfader
 
Innovation durch Scrum und Continuous Delivery
Innovation durch Scrum und Continuous DeliveryInnovation durch Scrum und Continuous Delivery
Innovation durch Scrum und Continuous Delivery
Peter Gfader
 
Speed = $$$
Speed = $$$Speed = $$$
Speed = $$$
Peter Gfader
 
Qcon london2012 recap
Qcon london2012 recapQcon london2012 recap
Qcon london2012 recap
Peter Gfader
 
Continuous Delivery with TFS msbuild msdeploy
Continuous Delivery with TFS msbuild msdeployContinuous Delivery with TFS msbuild msdeploy
Continuous Delivery with TFS msbuild msdeploy
Peter Gfader
 
Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...
Peter Gfader
 
Clean Code Development
Clean Code DevelopmentClean Code Development
Clean Code Development
Peter Gfader
 
Data Mining with SQL Server 2008
Data Mining with SQL Server 2008Data Mining with SQL Server 2008
Data Mining with SQL Server 2008
Peter Gfader
 
SSAS - Other Cube Browsers
SSAS - Other Cube BrowsersSSAS - Other Cube Browsers
SSAS - Other Cube Browsers
Peter Gfader
 
Reports with SQL Server Reporting Services
Reports with SQL Server Reporting ServicesReports with SQL Server Reporting Services
Reports with SQL Server Reporting Services
Peter Gfader
 
OLAP – Creating Cubes with SQL Server Analysis Services
OLAP – Creating Cubes with SQL Server Analysis ServicesOLAP – Creating Cubes with SQL Server Analysis Services
OLAP – Creating Cubes with SQL Server Analysis Services
Peter Gfader
 
Business Intelligence with SQL Server
Business Intelligence with SQL ServerBusiness Intelligence with SQL Server
Business Intelligence with SQL Server
Peter Gfader
 
SQL Server - Full text search
SQL Server - Full text searchSQL Server - Full text search
SQL Server - Full text searchPeter Gfader
 
Usability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET FeaturesUsability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET Features
Peter Gfader
 

More from Peter Gfader (20)

Achieving Technical Excellence in Your Software Teams - from Devternity
Achieving Technical Excellence in Your Software Teams - from Devternity Achieving Technical Excellence in Your Software Teams - from Devternity
Achieving Technical Excellence in Your Software Teams - from Devternity
 
You Can't Be Agile If Your Testing Practices Suck - Vilnius October 2019
You Can't Be Agile If Your Testing Practices Suck - Vilnius October 2019You Can't Be Agile If Your Testing Practices Suck - Vilnius October 2019
You Can't Be Agile If Your Testing Practices Suck - Vilnius October 2019
 
You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)
You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)
You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)
 
How to make more impact as an engineer
How to make more impact as an engineerHow to make more impact as an engineer
How to make more impact as an engineer
 
13 explosive things you should try as an agilist
13 explosive things you should try as an agilist13 explosive things you should try as an agilist
13 explosive things you should try as an agilist
 
You cant be agile if your code sucks
You cant be agile if your code sucksYou cant be agile if your code sucks
You cant be agile if your code sucks
 
Use Scrum and Continuous Delivery to innovate like crazy!
Use Scrum and Continuous Delivery to innovate like crazy!Use Scrum and Continuous Delivery to innovate like crazy!
Use Scrum and Continuous Delivery to innovate like crazy!
 
Innovation durch Scrum und Continuous Delivery
Innovation durch Scrum und Continuous DeliveryInnovation durch Scrum und Continuous Delivery
Innovation durch Scrum und Continuous Delivery
 
Speed = $$$
Speed = $$$Speed = $$$
Speed = $$$
 
Qcon london2012 recap
Qcon london2012 recapQcon london2012 recap
Qcon london2012 recap
 
Continuous Delivery with TFS msbuild msdeploy
Continuous Delivery with TFS msbuild msdeployContinuous Delivery with TFS msbuild msdeploy
Continuous Delivery with TFS msbuild msdeploy
 
Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...
 
Clean Code Development
Clean Code DevelopmentClean Code Development
Clean Code Development
 
Data Mining with SQL Server 2008
Data Mining with SQL Server 2008Data Mining with SQL Server 2008
Data Mining with SQL Server 2008
 
SSAS - Other Cube Browsers
SSAS - Other Cube BrowsersSSAS - Other Cube Browsers
SSAS - Other Cube Browsers
 
Reports with SQL Server Reporting Services
Reports with SQL Server Reporting ServicesReports with SQL Server Reporting Services
Reports with SQL Server Reporting Services
 
OLAP – Creating Cubes with SQL Server Analysis Services
OLAP – Creating Cubes with SQL Server Analysis ServicesOLAP – Creating Cubes with SQL Server Analysis Services
OLAP – Creating Cubes with SQL Server Analysis Services
 
Business Intelligence with SQL Server
Business Intelligence with SQL ServerBusiness Intelligence with SQL Server
Business Intelligence with SQL Server
 
SQL Server - Full text search
SQL Server - Full text searchSQL Server - Full text search
SQL Server - Full text search
 
Usability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET FeaturesUsability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET Features
 

Recently uploaded

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 

Recently uploaded (20)

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 

Work with data in ASP.NET

  • 1. Developing Windows and Web Applications using Visual Studio.NET Eric Phan Solution Architect
  • 2.
  • 3.
  • 5. 1 2
  • 6.
  • 7.
  • 12.
  • 13. Data
  • 14. Bring database to the web Show/view Data Enter
  • 16. What is ADO.NET? Set of classes that expose data access services to the .NET programmer ADO.NET provides a rich set of components for creating distributed, data-sharing applications It is an integral part of the .NET Framework, providing access to relational data, XML, and application data
  • 17. WebForm Apps WinForm Apps ADO.NET DataSets SQLConnection SQLCommand SQLDataAdapter SQLDataReader SQL Data Providers SQL Data XML Data Oracle Data …
  • 18. Objects Instead of DataSets we use classes Extensible Can embed logic and validation A more OO approach
  • 19. WebForm Apps WinForm Apps Objects/Entities Data Sources SQL Data XML Data Oracle Data …
  • 20. DataSets or Business Objects Why use DataSets A highly functional container for data that can be strongly typed Automatic change tracking for contained data Seamless data-binding support Why Use Objects Business Objects (NHibernate, NTiers, LINQ to SQL, LINQ to Entities) Light weight Good data-binding support Extensible and OO Very easy to use No SQL command Strings
  • 21. The new way!LINQ 2 EntitiesLINQ 2 SQL
  • 22. LINQ to SQL/Entities Brand new in the .NET 3.5 Framework Easily access and query your database through classes Logical access to class hierarchies Supports Inheritance Intuitive to use
  • 23. DBML File Database Mapping Language Contains a mapping of classes to database tables Has built in logic to handle selection, updates and deletes Can be customized www.hookedonlinq.com
  • 24. var customers = from c in db.Customers where c.FirstName.StartsWith(“A”) select c SQL Syntax
  • 25. var customers = db.Customers.Where(c => c.FirstName.StartsWith(“A”); Lambda Syntax
  • 26. Challenge, use this instead of SQL Server Management Studio for a month LINQPad
  • 27.
  • 28. See our Rules http://www.ssw.com.au/ssw/Standards/Rules/RulesToBetterLINQ.aspx
  • 30. Bind the data Data Data source
  • 31. Data Binding Data Data source From MSDN: Data binding is the process that establishes connection between the application UI and business logic Binding controls to data from database Bind a grid on Webform to a database table Simple, convenient, and powerful way to create a read/write link between the controls on a form and the data in their application
  • 32. Databinding the GridView (code) C# NorthwindDataContext db = newNorthwindDataContext(); GridView1.DataSource = db.Customers; GridView1.DataBind(); English Instantiate our data access class Make the datasource of GridView1 all the customers from our database Bind the Grid
  • 39.
  • 40. Display a Table from a Database
  • 42.
  • 43. Enabling these features Enable Delete, Insert, Update on the DataSource
  • 44. Enabling these features Enable them on the GridView
  • 45. Easy!
  • 46. Other Data Bindable Web Controls Bindable to Lists DataList DetailsView FormView Repeater/ListView DropDownList ListBox CheckBoxList RadioButtonList Bindable to Properties/Columns Most other controls
  • 47. Data-Bound Controls Most controls in .NET Framework support data binding Controls inherit from the WebControl base classwhich implements IDataBindingsAccessorinterface Important Data-binding properties DataSource DataMember DisplayMember ValueMember Design your own controls or purchase 3rd party controls
  • 49. Passing Parameters between pages Pass parameters to pages or controls Pass parameters to our data sources Parameters can be obtained from: Query String Session Variable Control Property Hidden Field Cookie
  • 50. 1. Create a CustomerDetails.aspx Add a Details View and create a new Datasource
  • 51. 2. Create a LINQ Data Source
  • 52. 3. Specify the Where clause
  • 53. 4. Make it read from the Query String
  • 54. 5. Change the Select on the GridView to Link to the CustomerDetails Page
  • 55. 6. Edit the templates
  • 56. 7. Delete Select and Add a Hyperlink
  • 57. 8. Configure the Hyperlink CustomerDetails.aspx?CustomerID={0}
  • 59. Validation – Don’t trust anyone
  • 60. Validation - Bring database to the web Show/view Data Enter
  • 61. Validation Why do we need it? PEBCAC Bad Data
  • 63. Why use Validations? Seamless verification of data fields Check for mandatory fields Check for correct data formats Check for data ranges Reduces incorrect data entered into your database Prevent possible runtime exceptions
  • 64. Validation Types Client Show/view Data Enter Client Server
  • 65. Validation Types Client-Side Validation Validations are performed before the form is posted back Quick and responsive for the end user Insecure Server-Side Validation Validation checks are performed on the server Secure because these checks cannot be easily by passed Sometimes can be slow Recommendation Use both the types This approach provides the best of both worlds Client Show/view Data Enter Client Server
  • 66. ASP.NET Validation Server Controls RequiredFieldValidator CompareValidator RangeValidator RegularExpressionValidator CustomValidator ValidationSummary
  • 67. To put the Northwind database up on the web? CRUD for all tables Pages for all tables Validation So how long do you think it would take...
  • 68. 1 line of code 5 Minutes
  • 69. Awesome starting point Learn more from http://www.asp.net/dynamicdata/ ASP.NET Dynamic Data
  • 70. Extend what’s given to you and you can make really great websites You can use it as a framework
  • 71.
  • 72. Any issues ... questions PeterGfader@ssw.com.au EricPhan@ssw.com.au
  • 73. Thank You! Gateway Court Suite 10 81 - 91 Military Road Neutral Bay, Sydney NSW 2089 AUSTRALIA ABN: 21 069 371 900 Phone: + 61 2 9953 3000 Fax: + 61 2 9953 3105 info@ssw.com.auwww.ssw.com.au
  • 74. Resources www.hookedonlinq.com http://www.asp.net/get-started/ http://weblogs.asp.net/scottgu/ http://www.asp.net/dynamicdata/ If you have the next awesome web ideahttp://www.microsoft.com/BizSpark/ http://www.ssw.com.au/ssw/Standards/Rules/RulesToBetterLINQ.aspx

Editor's Notes

  1. Click to add notesPeter Gfader Developing Windows and Web applications
  2. Request ResponseOpen browser and browse around
  3. Goal: Show View data to users on the webLet users enter and modify data
  4. Show how easy it isHow many code lines did i write?Show them the old wayHuge difference!
  5. Changes to Datasource get forwarded to databaseChanges from database get forwarded to data grid
  6. Property DataSource and DataMember on grid
  7. Show controls in VSDataList = More for List layout (http://msdn.microsoft.com/en-us/magazine/cc301328.aspx )DetailsView = mainly for editing (row/col switched) 1 record at a timeFormView = like detailsview but more control over html rendered code (layout) that’s goodListView = like datalist but more control again, see EA emp Repeater = same as Listview, Listview replaces repeaterDropDownListListBox = simple list of itemsCheckBoxListRadioButtonList
  8. Go to website: telerikTelerik RAD ControlsComponent ArtInfragisticsDevexpressJanus
  9. Suggest or common ones are querystring, hidden fieldCookies saving bits of info for all pagesE.g. Select a row from the grid and show the details in a DetailsViewPass the selected row’s ID (e.g. ContactID) as a query string parameterE.g. http://localhost:1234/MyWebApp/Details.aspx?ContactID=1
  10. Show url with IDPostback http://www.search-cube.com/
  11. Problem Exists Between Chair and ComputerClient database SWIFT project
  12. ASP.NET existing Validation controls create client side script for us
  13. CustomValidator Method Validate write your own code there (SERVER SIDE)