Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building Data-Centric Smart Client Applications Rajiv Sodhi Microsoft India.

Similar presentations


Presentation on theme: "Building Data-Centric Smart Client Applications Rajiv Sodhi Microsoft India."— Presentation transcript:

1 Building Data-Centric Smart Client Applications Rajiv Sodhi Microsoft India

2 Agenda Introduction To Smart Clients Performing Connected Operations Performing Client-Side Operations Creating an Offline Application

3 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 Device Adaptability Tough to Deploy Heavy Footprint DLL Hell Network Dependency Poor User Experience Rich UI Complex To Develop Rich User Experience Developer Productivity Responsive Broad Reach Easy Change Management Ease of Deployment

4 Microsoft Smart Client Platforms Mobile Field Smart Client Front-end to Enterprise LOB Systems Web site Smart Client Experiences Office System 2003Windows Mobile Windows Forms Version 1.1 Version 2.0 CurrentGeneration NextGeneration Version 1.0 Version 1.1 “Whidbey” Integrating Office XML with Enterprise Data E-Government Smart Client Front-end to Enterprise LOB Systems Web site Smart Client Experiences Mobile Field Web site Smart Client Experiences

5 Mobile Field Smart Client Front-end to Enterprise LOB Systems Web site Smart Client Experiences Windows Forms Version 1.1 Version 2.0 CurrentGeneration NextGeneration “Whidbey” Radically simplified application deployment ClickOnce deployment, update, rollback Visually Appealing UI New Data Controls Office Look and Feel Developer productivity Simplify working with data Fewer lines of code Few clicks.NET Framework distribution 120 million deployments Preinstalled on 60% of new machines and growing Included on SP2 CD Consumer 55% installed by end of ’04 75% installed by end of ’05 Enterprise 50% installed by end of ’04 68% installed by end of ‘05 Office System 2003Windows Mobile Version 1.0 Version 2.0 Integrating Office XML with Enterprise Data E-Government Smart Client Front-end to Enterprise LOB Systems Web site Smart Client Experiences Mobile Field Web site Smart Client Experiences Microsoft Smart Client Platforms

6 Office System 2003 Version 1.0 Version 2.0 Integrating Office XML with Enterprise Data E-Government Smart Client Front-end to Enterprise LOB Systems Web site Smart Client Experiences Connect live business data to your documents & access them off-line Increase velocity and accuracy of decision making Increase worker productivity Reduce error caused by data re-entry & copy/paste Leverage existing Office experience of end users Reach 400+ million practiced Office users Eliminate training and ramp up time on new applications Reduce new application burn-in errors Leverage rich and robust Office functionality High developer productivity = reduced time to develop Greatly improved maintainability & deployment options Optimize use of PC & central resources Mobile Field Smart Client Front-end to Enterprise LOB Systems Web site Smart Client Experiences Windows Forms Version 1.1 Version 2.0 CurrentGeneration NextGeneration “Whidbey” Windows Mobile Mobile Field Web site Smart Client Experiences Microsoft Smart Client Platforms

7 Office System 2003 Version 1.0 Version 2.0 Integrating Office XML with Enterprise Data E-Government Smart Client Front-end to Enterprise LOB Systems Web site Smart Client Experiences Mobile Field Smart Client Front-end to Enterprise LOB Systems Web site Smart Client Experiences Windows Forms Version 1.1 Version 2.0 CurrentGeneration NextGeneration “Whidbey” Windows Mobile Mobile Field Instant access to data anywhere, anytime Form factor and instant-on more appropriate for most field work Access existing Web services in SOAs Leverage.NET development skills and code on devices with.NET Compact Framework Web site Smart Client Experiences Microsoft Smart Client Platforms

8 Agenda Introduction To Smart Clients Performing Connected Operations Performing Client-Side Operations Creating an Offline Application

9 Performing Connected Operations Connection Class Represents a connection to a database SqlConnection, OracleConnection, etc. Requires a connection string Ex: “server=(local);database=Northwind;integrated security=true” Common methods Open Creates a connection to the database Close Closes the connection to the database BeginTransaction Starts a transaction and returns a Transaction object

10 Performing Connected Operations Command Executes SQL statements in the database CommandText DML, DDL, and DCL Contains a collection of parameters Common methods ExecuteReader Executes a Select statement and returns a DataReader ExecuteNonQuery Executes SQL statement, except Select Returns number of rows affected ExecuteScalar Executes a Select statement and returns a single value

11 Performing Connected Operations DataReader Server-Side, forward-only, read-only cursor Contains a collection of columns Ex: dr[“CustomerID”].ToString(); Common methods Read Advances to the next row Returns True if row exists Close Closes the DataReader and releases rowset GetX Returns a specific data type for the column value GetString, GetInt32, GetDateTime, etc.

12 Performing Connected Operations Populating an SqlDataReader using 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();

13 Performing Connected Operations Executing an SqlCommand using 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();

14 Performing Database Operations Directly

15 Agenda Introduction To Smart Clients Performing Connected Operations Performing Client-Side Operations Creating an Offline Application

16 Performing Client-Side Operations DataSet Set of DataTables and DataRelations Tightly integrated with XML Population Add DataTables Load XML Common Methods WriteXML/ReadXML WriteXMLSchema/ReadXMLSchema HasChanges GetChanges, AcceptChanges and RejectChanges Merge

17 Performing Client-Side Operations DataAdapter Bridge between a database and a DataTable Represents a set of Command objects SelectCommand, InsertCommand, UpdateCommand and DeleteCommand Common methods Fill Executes SelectCommand and populates DataTable Update Executes appropriate Command for each changed row Open and close connection if necessary

18 Performing Client-Side Operations Populating a DataSet using System.Data; using System.Data.SqlClient; … SqlConnection cn = new SqlConnection(“server=localhost;database=Northwind;inte grated 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”);

19 Performing Client-Side Operations Updating the Database DataRow tracks changes RowState property Row version GetChanges DataSet/DataTable Returns DataSet/DataTable of changed rows

20 Performing Client-Side Operations Updating the Database DataAdapter.Update Updates the database Executes appropriate command DataSet.Merge Merges contents into DataSet DataSet, DataTable or DataRow Matches data on primary key AcceptChanges Sets original value equal to current value Sets RowState property to DataRowState.Unchanged

21 Performing Client-Side Operations Updating 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();

22 Performing Client- Side Database Operations

23 Agenda Introduction To Smart Clients Performing Connected Operations Performing Client-Side Operations Creating an Offline Application

24 Creating an Offline Application Persisting a DataSet Populate DataSet DataAdapter.Fill WriteXml Can write data, schema, and changes Output determined by XmlWriteMode Use instead of DataAdapter.Update XmlWriteMode.DiffGram XML format Original and values of DataSet

25 Creating an Offline Application DiffGram Current Value … 11078 ALFKI 10 2003-07-01T00:00:00.0000000-04:00 2003-08-01T00:00:00.0000000-04:00 2003-07-05T00:00:00.0000000-04:00 0 180.0000 …

26 Creating an Offline Application DiffGram Original Value … 11078 ALFKI 10 2003-07-01T00:00:00.0000000-04:00 2003-08-01T00:00:00.0000000-04:00 0 180.0000

27 Creating an Offline Application Restoring a DataSet ReadXml Can read data, schema, and changes Input determined by XmlReadMode Use instead of DataAdapter.Fill XmlReadMode.DiffGram Reads DiffGram Adds current and original values to DataSet Update the database DataAdapter.Update

28 Creating an Offline Application

29 © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY. Content created by 3 Leaf Solutions


Download ppt "Building Data-Centric Smart Client Applications Rajiv Sodhi Microsoft India."

Similar presentations


Ads by Google