Click here to Skip to main content
15,173,454 members
Articles / Mobile Apps
Posted 29 Jan 2004


45 bookmarked

Pocket PC with SQL CE

Rate me:
Please Sign up or sign in to vote.
2.76/5 (26 votes)
29 Jan 2004CPOL2 min read
This article demonstrates how to use SQL CE and SQL Server 2000 with the help of Remote Data Access (RDA)


This article describes how to use SQL CE using VB. NET and how to transfer data from SQLCE (Pocket PC) to SQL Server 2000 which is running in your desktop system.

Client Requirement

  1. Pocket PC with Microsoft Windows powered
  2. Microsoft .Net compact Framework 1.0 (Default in PocketPC)

Server Requirement

  1. MS SQL server 2000 with SP3
  2. MS SQL CE 2000 with SP3
  3. Create DataBase named D1Temp and execute script "D1temp SQLScript.sql"


The basic idea behind this work is to update any information on the fly. i.e. If I am traveling from one location to another location if I seen
or knowing some interesting information. If I want those information to my data storage then just need a pocket PC and Internet connection.

On the flight I can note all the information and transfer the same to my desktop, which is running in some part of the world. I won't worry about the memory size of my Pocket PC because all the information is posted to the remote database.

You can make this work as a template and do your own mobile device application.

Using the code

Download the source code in that you can find a SQL script named SQLSCRIPT.sql. Create a Database (I used D1Temp) and run the script. Open Config.xml and specify correctly

  • DatabaseServer
  • DatabaseName
  • DatabaseLogin
  • DatabasePassword
  • IISLogin
  • IISPassword
If you are not properly configure this XML file then you will not get the expected result. Note: Make sure you are properly configured your SQLCE virtual folder and the IIS. The Database.vb files holds all the database related connections and query handling. The below code is used to connect to the Host database and populate the data to SQL CE
'Connect to SQL 2000
Dim rdaOleDbConnectString As String = _
  "Provider=sqloledb; Data Source=" & _
  oDBConfig.DatabaseServer & ";Initial" & _
  " Catalog=" & oDBConfig.PublisherDB & ";User Id=" & _
  oDBConfig.PublisherLogin & ";Password=" & _

  'create an RDA object to connect to the SQL Server CE 
  'database on the mobile device: 
  'Initialize the RDA object.
    rda = New SqlCeRemoteDataAccess

    rda.InternetUrl = oDBConfig.SqlCeUrl
    rda.LocalConnectionString = _
    "Provider=Microsoft.SQLSERVER." & _
    "OLEDB.CE.2.0;Data Source=" & oDBConfig.LocalDBLocation & _

    rda.InternetLogin = oDBConfig.IISLogin
    rda.InternetPassword = oDBConfig.IISPassword

    'Pull from SQL 2000
    rda.Pull("MyFavourite", "Select * from MyFavourite", _
    rdaOleDbConnectString, _

Getting back the details from PDA to SQL 2000 also same as above code except rda.Pull. Here we have to use rda.push :-

rda.Push("MyFavourite", rdaOleDbConnectString, _
And also I added some of functions for getting data into DataReader and executing SQL statements.

Points of Interest

When I tried using the emulator most of time it shows error "80072EFD request send data to the computer running IIS has failed for more information see HRESULT" even everything is configured properly. If I use my pocket PC instead of Emulator it works good. After that I used to run the SQL CE virtual folder path "http://sys1/sqlce/sscesa20.dll" often through my IE . Some times it works but most of time it does not. If this trick fails then I used this logic i.e. I will change IISLogin from "everest/rasheed" to "everest\rasheed" (Just changed the slash) if it fails next time then I will change IISLogin from "everest\rasheed" to "everest/rasheed" You won't believe it but this worked perfectly. I didn't know the secret of "slash" ;-)


  • First release 1.0


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

India India
Called as Rasheed. Completed Master of Computer science. Working as Senior Consultant in Chennai, India.

Try to achive in different stream

Comments and Discussions

GeneralRe: RDA Help me please Pin
salai20-Mar-05 22:51
Membersalai20-Mar-05 22:51 
GeneralModify sdf files on PC Pin
Eduardo Ramírez1-Oct-04 7:19
MemberEduardo Ramírez1-Oct-04 7:19 
GeneralSql Server Ce Pin
mathon6-Sep-04 0:55
Membermathon6-Sep-04 0:55 
GeneralGood Work Buddy - Problem 1 Pin
rap216-Jul-04 21:03
Memberrap216-Jul-04 21:03 
GeneralRe: Good Work Buddy - Problem 1 Pin
rasheed197911-Jul-04 21:53
Memberrasheed197911-Jul-04 21:53 
GeneralRe: Good Work Buddy - Problem 1 Pin
ESCjwang22-Jul-04 11:10
MemberESCjwang22-Jul-04 11:10 
GeneralRe: Good Work Buddy - Problem 1 Pin
rasheed197923-Jul-04 23:03
Memberrasheed197923-Jul-04 23:03 
GeneralRe: Good Work Buddy - Problem 1 Pin
MOISJWang25-Jul-04 4:05
MemberMOISJWang25-Jul-04 4:05 
Hi Rasheed,

Thanks for your effort. I will research this also and will let you know what I found. But it may take a while before I can get to it.


Software design/development are state of the arts and fun. Don't lose your dreams and visions.
GeneralRe: Good Work Buddy - Problem 1 Pin
celikol25-Jul-05 0:10
Membercelikol25-Jul-05 0:10 
GeneralRe: Good Work Buddy - Problem 1 Pin
Amey Chavan21-Oct-05 20:03
MemberAmey Chavan21-Oct-05 20:03 
GeneralRe: Good Work Buddy - Problem 1 Pin
Anonymous25-Oct-05 19:30
MemberAnonymous25-Oct-05 19:30 
GeneralError with DB1.cdb Pin
kkw200430-Jun-04 8:27
Memberkkw200430-Jun-04 8:27 
GeneralRe: Error with DB1.cdb Pin
rasheed197930-Jun-04 16:58
Memberrasheed197930-Jun-04 16:58 
GeneralRe: Error with DB1.cdb Pin
kkw20041-Jul-04 6:21
Memberkkw20041-Jul-04 6:21 
GeneralRe: Error with DB1.cdb Pin
rasheed19792-Jul-04 0:18
Memberrasheed19792-Jul-04 0:18 
Generalerror using MyFavourite Pin
lvTH23-Jun-04 6:49
MemberlvTH23-Jun-04 6:49 
GeneralRe: error using MyFavourite Pin
rasheed197930-Jun-04 17:00
Memberrasheed197930-Jun-04 17:00 
GeneralRe: error using MyFavourite Pin
lvTH30-Jun-04 22:10
MemberlvTH30-Jun-04 22:10 
GeneralPocket PC Pin
Aviram Solomon30-Apr-04 3:34
MemberAviram Solomon30-Apr-04 3:34 
QuestionSynchronising without IIS? Pin
rpadayachee28-Apr-04 4:25
Memberrpadayachee28-Apr-04 4:25 
AnswerRe: Synchronising without IIS? Pin
rasheed197926-May-04 17:31
Memberrasheed197926-May-04 17:31 
AnswerRe: Synchronising without IIS? Pin
salai20-Mar-05 20:52
Membersalai20-Mar-05 20:52 
Generalgreat code.... [modified] Pin
dharani17-Mar-04 21:11
Memberdharani17-Mar-04 21:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.