Windows Mobile 5.0 Data Access And Storage Webcast

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Windows Mobile 5.0 Data Access And Storage Webcast - Presentation Transcript

    1. Windows Mobile: Data Access and Storage Vinod Kumar M Technology Evangelist Microsoft India http://blogs.sqlxml.org/vinodkumar http://www.ExtremeExperts.com
    2. Where We’re Going today What’s New In…
      • Changes in SQL Mobile
      • Direct Data Management
      • Connectivity and Data Transfer
      • Tools and Productivity Enhancements
    3. Changes in SQL Mobile
    4. Changes in SQL Mobile Key new features
      • Multi-user Support
        • Can now access the same database from multiple programs simultaneously
      • Improved Query Processor
        • More optimized
        • No longer necessary to Compact to update statistics
    5. Changes in SQL Mobile Desktop Support
      • SQL Mobile now available on the Desktop
        • Databases can now be created on the desktop
        • Can now transfer a database using ActiveSync (no server engine required)
        • Can now administer database from desktop
    6. Changes in SQL Mobile Smartphone
      • Smartphone now supports SQL Mobile
        • Full featured support
        • Create, Query, Transactions…
        • Databinding
        • DataGrid
    7. Direct Data Management
    8. Direct Data Management
      • SqlCeResultset
        • Updatable scrolling SQL Mobile cursor
      • Dataset
        • Improved parity with full .NET Framework
        • Easier to synchronize changes to/from full .NET Framework
      • XML
        • XML Serialization
        • XPath Support
        • XML Schema
    9. SqlCeResultSet
      • SqlCeResultSet
        • Provides direct connectivity to the SQL Server Mobile Edition database
        • Supports forward and backward scrolling
        • Supports updates
        • Supports databinding
    10. SqlCeResultSet Features vs. Performance
      • Features comparable to DataSet commonly used features
        • Scrolling
        • Updatability
        • Databinding
      • Performance similar to SqlCeDataReader
        • Direct db access
        • No in-memory data duplication
    11. SqlCeResultSet Compatability with SqlCeDataReader
      • Inherits from SqlCeDataReader
        • Provides strongly typed getters
          • GetInt32(), GetString(), etc.
        • Provides SqlCeDataReader forward Read() method
        • Fully compatible with existing SqlCeDataReader code you may have
    12. SqlCeResultSet Usage
      • Created from SqlCeCommand ExecuteResultSet method
      • Specific behavior controlled by ResultSetOptions enumeration
    13. SqlCeResultSet Usage (continued) string sql = "Select ProductId, Desc, Qty, UnitPrice"; SqlCeConnection conn = new SqlCeConnection(@"Data Source = Orders.sdf"); SqlCeCommand commmand = new SqlCeCommand(sql, conn); SqlCeResultSet rs = commmand.ExecuteResultSet(ResultSetOptions.None); while (rs.Read()) { // retrieve column values from the current record }
    14. SqlCeResultSet Updatability
      • Full Support for updatability
        • Use ResultSetOptions.Updatable when executing the command
        • Use strongly typed Setters to modify columns
          • SetInt32, SetString
        • Call Update method to save record changes to the database
    15. SqlCeResultSet Updatability(continued) SqlCeResultSet rs = commmand.ExecuteResultSet(ResultSetOptions.Updatable); int idxProductId = rs.GetOrdinal("ProductId"); int idxDesc = rs.GetOrdinal("Desc"); int idxUnitPrice = rs.GetOrdinal("UnitPrice"); while (rs.Read()) { // Retrieve current values string productId = rs.GetString(idxProductId); string desc = rs.GetString(idxDesc); double unitPrice = rs.GetDouble(idxUnitPrice); // Prepend Product ID to the description rs.SetString(idxDesc, productId + " - " + desc); // Increase the price by 10% rs.SetDouble(idxUnitPrice, unitPrice * 1.1); // Apply record changes to db rs.Update(); }
    16. SqlCeResultSet Scrolling Access
      • Supports scrolling and direct record access
        • Use ResultSetOptions.Scrollable when executing the command
      • Provides Readxxx commands
        • ReadFirsts, ReadLast
        • Read, ReadPrevious
        • ReadAbsolute
        • ReadRelative
    17. SqlCeResultSet Scrolling Access (continued) SqlCeResultSet rs = commmand.ExecuteResultSet(ResultSetOptions.Scrollable | ResultSetOptions.Updatable ); // Read entire result backwards rs.ReadLast(); while(rs.ReadPrevious(); { // ... } // Absolute positioning rs.ReadAbsolute(10); // Read 10 records from beginning rs.ReadAbsolute(-10); // Read 10 records from end // Relative positioning rs.ReadRelative(5); // Read forward 5 records rs.ReadRelative(-5); // Read backward 5 records
    18. SqlCeResultSet Databinding
      • Create result set as normal
        • All ResultSetOptions allowable
        • Should include ResultSetOptions.Scrollable
      • Bind to the ResultSetView property of the result set
          • Provides same interfaces as DataView
            • ITypedList, IBindingList, IList, ICollection, IEnumerable, IDisposable
          • Can be used with any bindable controls
    19. SqlCeResultSet Databinding (continued) SqlCeResultSet rs = commmand.ExecuteResultSet(ResultSetOptions.Scrollable); listBox1.DataSource = rs.ResultSetView; listBox1.DisplayMember = "Desc"; listBox1.ValueMember = "ProductId"; textBox1.DataBindings.Add("Text", rs, "UnitPrice");
    20. DataSet
      • Several new methods added
        • New methods improve parity with desktop
        • New methods make synchronizing changes much easier
    21. DataSet New Features/Methods
      • Serialization methods now supported on a single table
      • DataSet.Copy method
      • DataSet.GetChanges method
      • DataSet.Merge
    22. DataSet DataTable Serialization
      • An individual data table can now be saved and restored
        • WriteXml
        • ReadXml
      • An individual data table can now be sent or received as a web service argument
        • Simply pass as an argument
    23. DataSet DataTable Serialization private void DeptComplete(string deptName, DataSet ds) { DataTable dt = ds.Tables["DeptDetail"]; dt.WriteXml(deptName + ".xml"); dt.Clear(); } private void DeptRestore(string deptName, DataSet ds) { DataTable dt = ds.Tables["DeptDetail"]; dt.Clear(); dt.ReadXml(deptName + ".xml"); }
    24. DataSet Copy Method
      • Copy creates an exact duplicate
        • Copy includes both data and schema
        • Useful for transferring a snapshot
          • Snapshot can be sent in background
          • Application can still continue to function and modify original DataSet
    25. DataSet Copy Method (continued) [WebMethod] public void SaveSnapshot(DataSet ds) { WriteDataSetToDatabase(ds); } private void Upload(DataSet ds) { DataServerProxy wsProxy = new DataServerProxy(); wsProxy.SaveSnapshot(ds); } Target Web Service Device call – Too slow, user must wait for whole upload
    26. DataSet Copy Method (continued) private void Upload(DataSet ds) { DataServerProxy wsProxy = new DataServerProxy(); wsProxy.BeginSaveSnapshot(ds, null, null); } private void Upload(DataSet ds) { DataServerProxy wsProxy = new DataServerProxy(); DataSet dsDupe = ds.Copy(); wsProxy.BeginSaveSnapshot(dsDupe, null, null); } Device call – Changes to data during upload will corrupt upload Device call – Send copy in background, this is safe
    27. DataSet Getting changes
      • GetChanges method
        • Retrieves changes since DataSet was loaded or AcceptChanges was called
        • Changes returned as a DataSet
        • The returned DataSet will generally be much smaller then original DataSet
        • Returned DataSet is optimized for merging
    28. DataSet Merging Changes
      • Merge method
        • Merges a DataSet into the current DataSet
        • Data is matched up based on primary key
        • Additions, deletions, modifications in the source DataSet are applied to the target
    29. DataSet Retrieving Changes from server [WebMethod] public DataSet GetLatest(DateTime startingDate) { return RetrieveChangesFromDatabase(startingDate); } private void GetUpdates(DataSet currentDs, DateTime lastUpdate) { DataServerProxy wsProxy = new DataServerProxy(); DataSet changeDs = wsProxy.GetLatest(lastUpdate); currentDs.Merge(changeDs); } Web method on server Call to web method from device
    30. DataSet Sending Changes to the server [WebMethod] public void StoreUpdates(DataSet changeDs) { ApplyChangesToDataBase(changeDs); } private void SendChanges(DataSet currentDs) { DataServerProxy wsProxy = new DataServerProxy(); DataSet changeDs = currentDs.GetChanges(); wsProxy.StoreUpdates(changeDs); } Web method on server Call to web method from device
    31. XML Support
      • Added more XML features
        • Greater parity with the full framework
        • XML Serialization
        • XPath
        • XML Schema
    32. XML Serializer
      • Classes can now be serialize/deserialized
        • XmlSerializer class is the engine
        • Serialize saves class instance as XML
        • Deserialize restores the class instance
      • Serialization Control
        • Class must have default constructor
        • Attributes can control details
          • XmlElement
          • XmlAttribute
    33. XPath
      • XPath now supported by XmlDocument
        • Rich support for XPath queries
        • Notably simplifies XML processing
      • Methods
        • SelectNode
          • Returns a single matching node
        • SelectNodes
          • Returns list of matching nodes
    34. XmlSchema
      • XmlSchema provides XML validation engine
        • Eliminates the need to validate explicitly in code
        • Useful for verifying that a document appears as expected
        • Useful for verifying content to legacy web services
        • Can programmatically construct schemas
    35. Connectivity and Data Transfer
    36. Connectivity and Data Transfer
      • Detecting changes in connectivity
        • Your application can now respond to changes in connectivity!!
        • Your application can the know type of connectivity (GPRS, Modem, ActiveSync…)
      • MSMQ
        • Reliable message delivery
        • Automatically handles connectivity
    37. Connectivity Detecting changes in connectivity
      • Device connectivity is inconsistent
        • Connectivity comes and goes
        • Type of connectivity may vary during application lifetime
          • GPRS
          • Modem
          • ActiveSync
          • WiFi
        • Applications must behave gracefully in the face of these changes
    38. Tools and Productivity Enhancements
    39. Tools and Productivity Enhancements
      • Visual Studio for Devices
        • Manage device databases from your desktop!!
        • Copy SQL Mobile databases between your desktop and device
        • Generating typed Datasets
    40. Create and Manage
      • Can now administer database from the desktop
        • Create new database
        • Add tables
        • Define columns and indexes
    41. Create New Database
    42. Creating New Table
    43. Automatically adds to device
    44. Typed DataSets
      • .NET CF now supports typed DataSets
        • Provides strongly typed table structure
        • Strongly typed properties of the column getters
    45. Summary
      • Great enhancement to SQL Mobile
      • SqlCeResultSet provides updatable, scrollable cursor
      • DataSet provides new methods to make sync easier
      • Rich XML support
      • Can easily detect connectivity
      • Tools make device DB development as easy as server-based DB’s
      • For The Contest Questions and The Feedback Form, please log on to:
      • http://www.microsoft.com/India/ webcasts/eval/jan170430
    46. © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
    SlideShare Zeitgeist 2009

    + Vinod KumarVinod Kumar Nominate

    custom

    789 views, 0 favs, 0 embeds more stats

    Done as part of Webcast for Data Access with WM5.0 more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 789
      • 789 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories