building data-centric smart client applications rajiv sodhi microsoft india
TRANSCRIPT
Building Data-Centric Smart Client ApplicationsBuilding Data-Centric Smart Client Applications
Rajiv SodhiMicrosoft India
AgendaAgenda
Introduction To Smart ClientsPerforming Connected OperationsPerforming Client-Side OperationsCreating an Offline Application
Smart clients are easily deployed and managed client applications that provide an adaptive and interactive experience by leveraging
local resources and intelligently connecting to distributed data sources.
Web Services &Offline/Online
support
DeviceAdaptability
Tough toDeploy
HeavyFootprint
DLL Hell
NetworkDependency
Poor UserExperience
Rich UIComplex
To Develop
Rich UserExperience
DeveloperProductivity
Responsive
BroadReach
Easy ChangeManagement
Ease ofDeployment
Microsoft Smart Client Platforms
Mobile Mobile Field Field
Mobile Mobile Field Field
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Office System 2003 Windows MobileWindows Forms
Version 1.1
Version 2.0
CurrentCurrentGenerationGeneration
NextNextGenerationGeneration
Version 1.0
Version 1.1“Whidbey”
Integrating Integrating Office XML Office XML
with with Enterprise Enterprise
Data Data
Integrating Integrating Office XML Office XML
with with Enterprise Enterprise
Data Data
E-GovernmentE-GovernmentE-GovernmentE-Government
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Mobile Mobile Field Field
Mobile Mobile Field Field
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Mobile Mobile Field Field
Mobile Mobile Field Field
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Windows Forms
Version 1.1
Version 2.0
CurrentCurrentGenerationGeneration
NextNextGenerationGeneration
“Whidbey”
Radically simplified application deployment
ClickOnce deployment, update, rollback
Visually Appealing UINew Data ControlsOffice Look and Feel
Developer productivitySimplify working with dataFewer lines of codeFew clicks
.NET Framework distribution120 million deploymentsPreinstalled on 60% of new machines and growingIncluded on SP2 CDConsumer
55% installed by end of ’0475% installed by end of ’05
Enterprise50% installed by end of ’0468% installed by end of ‘05
Office System 2003 Windows Mobile
Version 1.0
Version 2.0
Integrating Integrating Office XML Office XML
with with Enterprise Enterprise
Data Data
Integrating Integrating Office XML Office XML
with with Enterprise Enterprise
Data Data
E-GovernmentE-GovernmentE-GovernmentE-Government
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Mobile Mobile Field Field
Mobile Mobile Field Field
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Microsoft Smart Client Platforms
Office System 2003
Version 1.0
Version 2.0
Integrating Integrating Office XML Office XML
with with Enterprise Enterprise
Data Data
Integrating Integrating Office XML Office XML
with with Enterprise Enterprise
Data Data
E-GovernmentE-GovernmentE-GovernmentE-Government
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Connect live business data to your documents & access them off-line
Increase velocity and accuracy of decision makingIncrease worker productivityReduce error caused by data re-entry & copy/paste
Leverage existing Office experience of end users
Reach 400+ million practiced Office usersEliminate training and ramp up time on new applicationsReduce new application burn-in errors
Leverage rich and robust Office functionality
High developer productivity = reduced time to develop Greatly improved maintainability & deployment optionsOptimize use of PC & central resources
Mobile Mobile Field Field
Mobile Mobile Field Field
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Windows Forms
Version 1.1
Version 2.0
CurrentCurrentGenerationGeneration
NextNextGenerationGeneration
“Whidbey”
Windows Mobile
Mobile Mobile Field Field
Mobile Mobile Field Field
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Microsoft Smart Client Platforms
Office System 2003
Version 1.0
Version 2.0
Integrating Integrating Office XML Office XML
with with Enterprise Enterprise
Data Data
Integrating Integrating Office XML Office XML
with with Enterprise Enterprise
Data Data
E-GovernmentE-GovernmentE-GovernmentE-Government
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Mobile Mobile Field Field
Mobile Mobile Field Field
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Smart Client Smart Client Front-end to Front-end to
Enterprise LOB Enterprise LOB SystemsSystems
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Windows Forms
Version 1.1
Version 2.0
CurrentCurrentGenerationGeneration
NextNextGenerationGeneration
“Whidbey”
Windows Mobile
Mobile Mobile Field Field
Mobile Mobile Field Field
Instant access to data anywhere, anytimeForm factor and instant-on more appropriate for most field workAccess existing Web services in SOAsLeverage .NET development skills and code on devices with .NET Compact Framework
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Web siteWeb siteSmart ClientSmart ClientExperiencesExperiences
Microsoft Smart Client Platforms
AgendaAgenda
Introduction To Smart ClientsPerforming Connected OperationsPerforming Client-Side OperationsCreating an Offline Application
Performing Connected OperationsConnection Class
Performing Connected OperationsConnection Class
Represents a connection to a databaseSqlConnection, OracleConnection, etc.
Requires a connection stringEx: “server=(local);database=Northwind;integrated security=true”
Common methodsOpen
Creates a connection to the database
CloseCloses the connection to the database
BeginTransactionStarts a transaction and returns a Transaction object
Performing Connected OperationsCommand
Performing Connected OperationsCommand
Executes SQL statements in the databaseCommandTextDML, DDL, and DCL
Contains a collection of parametersCommon methods
ExecuteReaderExecutes a Select statement and returns a DataReader
ExecuteNonQueryExecutes SQL statement, except SelectReturns number of rows affected
ExecuteScalarExecutes a Select statement and returns a single value
Performing Connected OperationsDataReader
Performing Connected OperationsDataReader
Server-Side, forward-only, read-only cursorContains a collection of columns
Ex: dr[“CustomerID”].ToString();
Common methodsRead
Advances to the next rowReturns True if row exists
CloseCloses the DataReader and releases rowset
GetXReturns a specific data type for the column valueGetString, GetInt32, GetDateTime, etc.
Performing Connected OperationsPopulating an SqlDataReader
Performing Connected OperationsPopulating an SqlDataReaderusing System.Data.SqlClient…SqlCommand cmd = new SqlCommand("SELECT * FROM Customers,cn);
cn.Open();SqlDataReader dr =
cmd.ExecuteReader( CommandBehavior.CloseConnection);
if(dr.Read()){
txtCustomerID.Text = dr["CustomerID"].ToString();txtCompanyName.Text = dr["CompanyName"].ToString();txtContactName.Text = dr["ContactName"].ToString();
}
dr.Close();
Performing Connected OperationsExecuting an SqlCommand
Performing Connected OperationsExecuting an SqlCommandusing System.Data.SqlClient…SqlConnection cn = new
SqlConnection(“server=localhost;database=Northwind;integrated security=yes”);
SqlCommand cmdDeleteProduct = new SqlCommand("DELETE FROM Products WHERE ProductID = @ProductID",cn);
cmdDeleteProduct.Parameters.Add(new SqlParameter("@ProductID", System.Data.SqlDbType.Int, 4));
cmdDeleteProduct.Parameters["@ProductID"].Value = ProductID;
cn.Open();cmdDeleteProduct.ExecuteNonQuery();cn.Close();
Performing Database Performing Database Operations DirectlyOperations Directly
AgendaAgenda
Introduction To Smart ClientsPerforming Connected OperationsPerforming Client-Side OperationsCreating an Offline Application
Performing Client-Side OperationsDataSet
Performing Client-Side OperationsDataSet
Set of DataTables and DataRelations Tightly integrated with XMLPopulation
Add DataTablesLoad XML
Common MethodsWriteXML/ReadXMLWriteXMLSchema/ReadXMLSchemaHasChangesGetChanges, AcceptChanges and RejectChangesMerge
Performing Client-Side OperationsDataAdapter
Performing Client-Side OperationsDataAdapter
Bridge between a database and a DataTableRepresents a set of Command objects
SelectCommand, InsertCommand, UpdateCommand and DeleteCommand
Common methodsFill
Executes SelectCommand and populates DataTable
UpdateExecutes appropriate Command for each changed row
Open and close connection if necessary
Performing Client-Side OperationsPopulating a DataSet
Performing Client-Side OperationsPopulating a DataSetusing System.Data;using System.Data.SqlClient;…SqlConnection cn = new
SqlConnection(“server=localhost;database=Northwind;integrated security=yes”);
daOrderDetails = new SqlDataAdapter("SELECT OrderID, ProductID, UnitPrice, Quantity, Discount FROM [Order Details]",cn);
daOrderDetails.MissingSchemaAction = MissingSchemaAction.AddWithKey;
DataSet dsNorthwind = new DataSet();daOrderDetails.Fill(dsNorthwind, “Order Details”);
Performing Client-Side OperationsUpdating the Database
Performing Client-Side OperationsUpdating the Database
DataRow tracks changesRowState propertyRow version
GetChangesDataSet/DataTableReturns DataSet/DataTable of changed rows
Performing Client-Side OperationsUpdating the Database
Performing Client-Side OperationsUpdating the DatabaseDataAdapter.Update
Updates the databaseExecutes appropriate command
DataSet.MergeMerges contents into DataSet
DataSet, DataTable or DataRow
Matches data on primary key
AcceptChangesSets original value equal to current valueSets RowState property to DataRowState.Unchanged
Performing Client-Side OperationsUpdating the Database
Performing Client-Side OperationsUpdating the Database…DataTable dtChanges;dtChanges = ds.Tables["Employees"].GetChanges(DataRowState.Added);if(dtChanges != null){
daEmployees.Update(dtChanges);ds.Merge(dtChanges);
}
dtChanges = ds.Tables[“Orders"].GetChanges(DataRowState.Added);if(dtChanges != null){
daOrders.Update(dtChanges);ds.Merge(dtChanges);
}…ds.AcceptChanges();
Performing Client-Performing Client-Side Database Side Database
OperationsOperations
AgendaAgenda
Introduction To Smart ClientsPerforming Connected OperationsPerforming Client-Side OperationsCreating an Offline Application
Creating an Offline ApplicationPersisting a DataSetCreating an Offline ApplicationPersisting a DataSet
Populate DataSetDataAdapter.Fill
WriteXmlCan write data, schema, and changesOutput determined by XmlWriteModeUse instead of DataAdapter.Update
XmlWriteMode.DiffGramXML formatOriginal and values of DataSet
Creating an Offline ApplicationDiffGram Current ValueCreating an Offline ApplicationDiffGram Current Value<?xml version="1.0" standalone="yes"?><diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> <EmployeesOrdersDS xmlns="http://tempuri.org/EmployeesOrdersDS.xsd">…
<Orders diffgr:id="Orders831" msdata:rowOrder="830"> <OrderID>11078</OrderID> <CustomerID>ALFKI</CustomerID> <EmployeeID>10</EmployeeID> <OrderDate>2003-07-01T00:00:00.0000000-04:00</OrderDate> <RequiredDate>2003-08-01T00:00:00.0000000-04:00</RequiredDate> <ShippedDate>2003-07-05T00:00:00.0000000-04:00</ShippedDate> <Freight>0</Freight> <Total>180.0000</Total>
</Orders>…
Creating an Offline ApplicationDiffGram Original ValueCreating an Offline ApplicationDiffGram Original Value… <diffgr:before> <Orders diffgr:id="Orders831" msdata:rowOrder="830"
xmlns="http://tempuri.org/EmployeesOrdersDS.xsd"> <OrderID>11078</OrderID> <CustomerID>ALFKI</CustomerID> <EmployeeID>10</EmployeeID> <OrderDate>2003-07-01T00:00:00.0000000-04:00</OrderDate> <RequiredDate>2003-08-01T00:00:00.0000000-04:00</RequiredDate> <Freight>0</Freight> <Total>180.0000</Total> </Orders> </diffgr:before></diffgr:diffgram>
Creating an Offline ApplicationRestoring a DataSetCreating an Offline ApplicationRestoring a DataSet
ReadXmlCan read data, schema, and changesInput determined by XmlReadModeUse instead of DataAdapter.Fill
XmlReadMode.DiffGramReads DiffGramAdds current and original values to DataSet
Update the databaseDataAdapter.Update
Creating an Offline Creating an Offline ApplicationApplication
© 2003 Microsoft Corporation. All rights reserved.© 2003 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.Content created by 3 Leaf SolutionsContent created by 3 Leaf Solutions