Solved

Connect to sdf file on pocket pc

Posted on 2008-06-17
6
1,907 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 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now