Professional Documents
Culture Documents
Not Your Father's Data Access
Not Your Father's Data Access
NET
Not your fathers Data Access
http://adoguy.com
Who I am
Shawn Wildermuth swildermuth@adoguy.com Author of Pragmatic ADO.NET Editor of http://OnDotNet.com For More Info: http://adoguy.com This Presentation can be found at:
http://adoguy.com/presentations
http://adoguy.com
http://adoguy.com
http://adoguy.com
http://adoguy.com
Introducing ADO.NET
Managed Providers DataSet DataBinding in ASP.NET DataBinding in WinForms
http://adoguy.com
Managed Providers
ADO.NETs Version of Providers (ADO, OLE/DB) and Drivers (ODBC) Not the only way to access data in .NET (most notably the Xml classes) Made up of a number of managed classes that implement known interfaces
http://adoguy.com
System.Data Namespace
Dataset DataTable DataRow DataColumn etc. Data Relation ForeignKeyConstraint
System.Data.Common Namespace
DataAdapter DataTableMapping etc. DbDataRecord
Your Provider
System.Data
SqlDataAdapter
DataSet
SqlCommand
SqlDataReader
SqlParameters
SqlParameter
SqlErrors
SqlError
http://adoguy.com
http://adoguy.com
The DataSet
DataSet
Tables
DataTable Rows DataRow DataTable Rows DataRow
http://adoguy.com
Typed DataSets
Strong Typing XSD Based Schema Simple to Setup relationships, constraints, etc. Not very much use if you have amorphous data
http://adoguy.com
http://adoguy.com
Using DataSets
Bulk Data Loading is supported Two possible versions of all data, RowState.Original and RowState.Modified Relationship Navigation DataViews
http://adoguy.com
Disconnected Concurrency
Optimistic Concurrency Supported by CommandBuilders Optimistic Concurrency could be more efficient Pessimistic Concurrency can be achieved with Check-out, Check-in
http://adoguy.com
XML Integration
XmlDataDocument
View DataSets as XmlDocuments
http://adoguy.com
http://adoguy.com
Scalability in ADO.NET
Scale Out the Database as DataSets in the Middle Tier Use DiffGrams to Keep DataSets in Sync With SQL Server 2K
Can use DiffGrams to update the database Caveats about different DiffGram format
http://adoguy.com
DataBinding in ASP.NET
http://adoguy.com
http://adoguy.com
DataBinding in WinForms
using System.Data; using System.Windows.Forms; DataSet dataSet = new DataSet(); // ... listBox1.DataSource = dataSet.Tables[0]; listBox1.DisplayMember = "CompanyName"; listBox1.ValueMember = "CustomerID";
http://adoguy.com
Master-Detail Binding
Set multiple object to same DataSource Set DataMember to name of Relationship Use CurrencyManager to move the cursor if you do not want to use the master control
http://adoguy.com
Quick Rants
Classic ADO has a role in .NET Batch Queries are cool! Caveats for SqlClients Connection Pooling Trust your DBAs and strive to be like them :)
http://adoguy.com
Questions?
http://adoguy.com