Copy file from PPC to PC...

Last post 11-20-2008 5:19 by rajdarwai. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-10-2008 6:01

    • klode
    • Not Ranked
    • Joined on 09-10-2008
    • Posts 1

    Copy file from PPC to PC...

    Hi at all,

    I need to copy a file from a device connected with USB throw activesync ( version 4.5.5096.0 ). Now, the state is:

    1. ActiveSync connected;

    2. A little VB.NET software from the PC have this code:

     

    Dim rr As New OpenNETCF.Desktop.Communication.RAPI
                rr.ActiveSync.AutoConnect = True
                rr.ActiveSync.ConnectAsGuestOnly = True
                rr.ActiveSync.ConnectNow()
                Debug.Print(rr.ActiveSync.Version)

                rr.CopyFileOnDevice("c:\filefromdevice.txt", "test.txt", True)
                rr.CopyFileFromDevice(SdfToDesktop, "test.txt", True)
            Catch ERRORE As OpenNETCF.Desktop.Communication.RAPIException
                frmMain.Cursor = Cursors.Default
                MsgBox(ERRORE.Message)
                Exit Sub
            End Try

            Dim cConn As String
            cConn = "DATA SOURCE = " & SdfToDesktop
            Try
                cnn.ConnectionString = cConn
                cnn.Open()
            Catch ex As System.Exception

                MsgBox("Error open sdf: " & vbCrLf & ex.Message)

                cnn.Close()

                cnn.Dispose()

                Exit Sub

            End Try

            Dim myReader As System.Data.SqlServerCe.SqlCeDataReader
            Dim cmd As System.Data.SqlServerCe.SqlCeCommand = cnn.CreateCommand
            cmd.CommandText = "select * FROM tblWork"
            myReader = cmd.ExecuteReader()
            Debug.Print(myReader.FieldCount)

            ' to be continue....with your code

        End Sub

     

    But I cannot copy any file... Can you help me???

    Best Regards

     

    kL0d3
     

    Filed under: ,
  • 09-10-2008 8:19 In reply to

    • Neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,349

    Re: Copy file from PPC to PC...

    klode:
    But I cannot copy any file... Can you help me???

    Being vague doesn't help anyone, including yourself. Be specific about your problem so that we can help you. Are there any exceptions thrown? Is the scenario consistently reproducible? What is the expected result? What is the actual result? These are the kind of questions you should be asking yourself when asking others for help.

    Also, your CopyFileOnDevice method call contains invalid parameters. CopyFileOnDevice does just what it says -- it copies a file that exists on the device to another file on the device. So "C:\SomeFileFromDevice.txt" is completely invalid since Windows Mobile has no concept of drive letters for its volumes.

    klode:
    ' to be continue....with your code
    For more information on our development rates, contact sales@opennetcf.com.
    Neil Cowburn
    OpenNETCF Consulting

      
  • 11-20-2008 5:19 In reply to

    Re: Copy file from PPC to PC...

    Hi

    try this code i have use in my application. 

    Dim syncObj As New OpenNETCF.Desktop.Communication.RAPI

    If syncObj.DevicePresent Then

    syncObj.Disconnect()

    syncObj.Connect()

    If syncObj.DeviceFileExists("\My Documents\Systemfile.csv") = True Then

    syncObj.CopyFileFromDevice(Application.StartupPath & "\PDAFiles\Systemfile.csv", "\My Documents\Systemfile.csv")

    End If

    end if

Page 1 of 1 (3 items)