[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Connect to sdf file on pocket pc

Posted on 2008-06-17
6
Medium Priority
?
1,936 Views
Last Modified: 2013-12-05
I simply want to connect to an sdf file on a pocket pc with a connection string from a desktop application. I think this should be simple. Then select all records from a table and copy to an sdf file on the desktop. I have looked into rda and other solutions but they seem to confusing. There has to be an easier way.

What about a connection string like this

Dim SqlConn As SqlCeConnection
        Dim DataPath As String
        DataPath = "\DVADGolf.sdf"
        SqlConn = New SqlCeConnection("Data Source=" & DataPath)
        SqlConn.Open()
        Dim DA As SqlCeDataAdapter
        DA = New SqlCeDataAdapter
        Dim Str_Sql As String
        Str_Sql = "Select * from tblplayer"
        Dim CmdSelect As SqlCeCommand
        CmdSelect = New SqlCeCommand(Str_Sql, SqlConn)
        DA.SelectCommand = CmdSelect
        Dim DS As DataSet
        DS = New DataSet
        SqlConn.Close()


I will not need the bottom part. I just copied some code I found. I will need to add an update statement or insert (I think)
0
Comment
Question by:wiswalld
  • 3
  • 3
6 Comments
 
LVL 24

Accepted Solution

by:
alexey_gusev earned 2000 total points
ID: 21802765
hi there,

as far as I know you can't do it in that direction (PC->PDA) while from PDA to PC you can use RDA.

Nevertheless, you can use RAPI (either direct wrappers or e.g. OpenNETCF.Desktop.Communication classes) to
(1) copy sdf file from PDA to desktop or
(2) from desktop application, execute a method int C++ dll resided on PDA (which you need to develop) via CeRapiInvoke() - this dll may execute all you want to as it is running on the device

If anyone knows better solutions I'd be glad to know
0
 
LVL 13

Author Comment

by:wiswalld
ID: 21802941
You are really shooting me down. I thought a simple connection string like this would work

Imports System.Data.SqlServerCe

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim connection As SqlCeConnection
        connection = New SqlCeConnection("Data Source=\MyDatabase.sdf")
        connection.Open()
    End Sub
End Class
0
 
LVL 24

Expert Comment

by:alexey_gusev
ID: 21803011
as you can see e.g. here (http://msdn.microsoft.com/en-us/library/aa226134(SQL.80).aspx) it is for Compact Framework. Your code will work perfectly well on Windows Mobile, but not from desktop to PDA

or I completely misunderstood you?
0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
LVL 13

Author Comment

by:wiswalld
ID: 21803099
No I think you got me. I want to connect to an sdf file on a mobile device and copy table data to an sdf file on a desktop. I want to create an application using an sdf file to avoid having to have clients use sql server. So I wanted to create a desktop windows application with a button that will open the connection to the pocket pc and copy records to the desktop sdf file.
0
 
LVL 24

Expert Comment

by:alexey_gusev
ID: 21803147
thus that's no way to do it (I hope I am wrong :) , but it seems to be just hard fact)

but you still can employ the 2nd solution I mentioned, that is, using RAPI and C++ dll on PDA which your desktop app can talk to
0
 
LVL 13

Author Comment

by:wiswalld
ID: 21805448
I am not using C++. I was hoping to use vb.net. Can this work the other way. A sync button the pocket pc to connect to the desktop
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Unable to change the program that handles the scan event from a network attached Canon/Brother printer/scanner. This means you'll always have to choose which program handles this action, e.g. ControlCenter4 (in the case of a Brother).
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question