Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Transfer data faster

Transfer data faster

Scheduled Pinned Locked Moved Mobile
databasesql-serversysadminxmlquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dandi18
    wrote on last edited by
    #1

    hi guys Im transfering data from sql server 2005 to comapact framework database (*.sdf) My way to do so is : Export the table into an XML file (using DataTable) dt.WriteXml(FName, System.Data.XmlWriteMode.IgnoreSchema) And on the mobile device I load the XML and save the Dataset dt.ReadXml(FileName) da.Update(DataSet11) Everything is working only my table contains about 1500 records (20 fields) and it takes about 6 minutes to load and save. Is there any way or Method to do this any faster ? Thanks in Advance Dan.

    M D 2 Replies Last reply
    0
    • D dandi18

      hi guys Im transfering data from sql server 2005 to comapact framework database (*.sdf) My way to do so is : Export the table into an XML file (using DataTable) dt.WriteXml(FName, System.Data.XmlWriteMode.IgnoreSchema) And on the mobile device I load the XML and save the Dataset dt.ReadXml(FileName) da.Update(DataSet11) Everything is working only my table contains about 1500 records (20 fields) and it takes about 6 minutes to load and save. Is there any way or Method to do this any faster ? Thanks in Advance Dan.

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      Rather ironically for something called 'SQL Server CE', the SQL language is the worst, slowest way to do anything. If you're using .NET Compact Framework 2.0, the solution for loading data that's the fastest to execute while still being pretty readable and maintainable is to use the SqlCeResultSet class. To do this, create a SqlCeCommand, passing just the name of the table to modify in the query text parameter. Then set the command type to CommandType.TableDirect. Associate it with an open SqlCeConnection and call ExecuteResultSet, using the ResultSetOptions.Updatable option. Then, on the SqlCeResultSet, call CreateRecord to get a new record, set the record's properties, then call Insert to insert it into the table. See SQL Server Compact Edition Insert Performance[^] for details on just how big a difference this makes. Equally, a direct table access operation is far, far faster than SELECTing from that table - not just time to first row being returned, but even the time to access each subsequent row. To access the results in a particular order, you can use the IndexName property to use a named index on the table, and you can use the SetRange method to restrict the set of results that are returned.


      DoEvents: Generating unexpected recursion since 1991

      1 Reply Last reply
      0
      • D dandi18

        hi guys Im transfering data from sql server 2005 to comapact framework database (*.sdf) My way to do so is : Export the table into an XML file (using DataTable) dt.WriteXml(FName, System.Data.XmlWriteMode.IgnoreSchema) And on the mobile device I load the XML and save the Dataset dt.ReadXml(FileName) da.Update(DataSet11) Everything is working only my table contains about 1500 records (20 fields) and it takes about 6 minutes to load and save. Is there any way or Method to do this any faster ? Thanks in Advance Dan.

        D Offline
        D Offline
        DigiOz Multimedia
        wrote on last edited by
        #3

        dandi18 wrote:

        Is there any way or Method to do this any faster ?

        Yes. Use SharpZipLib (also known as NZipLib) CF library to compress the files before sending them over. You can get it here: http://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx[^]

        Pete Soheil DigiOz Multimedia http://www.digioz.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups