Solved

Connect to sdf file on pocket pc

Posted on 2008-06-17
6
1,927 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 24

Accepted Solution

by:
alexey_gusev earned 500 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
Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

 
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

An article on effective troubleshooting
Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
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 …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

729 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