Click here to Skip to main content
Click here to Skip to main content

Pocket PC with SQL CE

, 29 Jan 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
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" Wink | ;-)


  • 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

GeneralMy vote of 2 PinmemberRob Graham5-May-09 6:01 
Generaldb connection error Pinmemberashuangrish27-Nov-08 22:44 
GeneralRe: db connection error Pinmemberrasheed197930-Nov-08 19:38 
GeneralRe: db connection error Pinmemberashuangrish1-Dec-08 1:53 
GeneralRe: db connection error Pinmemberashuangrish5-Dec-08 1:28 
GeneralRe: db connection error Pinmemberomid200223-Feb-09 9:05 
Generalhelp Rasheed :( Pinmemberthree.leaf12-Sep-08 13:46 
Generalphone incoming call information Pinmemberprats115-Jun-07 1:28 
GeneralE r r o r PinmemberPavan_pareta2-Jun-07 1:13 
Generalmissing method exception Pinmembermokhabarat3-May-07 13:21 
Generalsql express Pinmemberrajeshatsrin20-Apr-07 6:01 
QuestionError when synchronize data from Pocket PC to Pc and opposite Pinmembertommyitvn5-Dec-06 20:21 
AnswerRe: Error when synchronize data from Pocket PC to Pc and opposite Pinmemberrasheed197922-Dec-06 2:20 
GeneralMissing Method Exception Pinmembervictorarce7-Jul-06 7:56 
GeneralRe: Missing Method Exception Pinmemberstorystar31-Oct-06 9:57 
Generalrasheed..plz help Pinmembersudhacnaidu8-Jun-06 19:47 
GeneralRe: rasheed..plz help Pinmembersudhacnaidu9-Jun-06 1:21 
GeneralRe: rasheed..plz help Pinmemberrasheed197911-Jun-06 17:55 
Generalerror with initialize SQL Pinmembersudhacnaidu8-Jun-06 19:41 
GeneralBook PinmemberBaskras1214-May-06 3:58 
GeneralRe: Book Pinmemberacc12345678907-Mar-07 3:51 
GeneralNot able to Sync PinmemberArathi Vasupal27-Mar-06 0:45 
GeneralIs there away to send to Desktop Ms Access Pinmembersilkkeng7-Mar-06 17:19 
GeneralRe: Is there away to send to Desktop Ms Access Pinmemberrasheed197913-Mar-06 16:05 
GeneralProblem installing SQL server CE Pinmemberronithefrnd1-Jan-06 18:45 
GeneralRe: Problem installing SQL server CE Pinmemberrasheed19791-Jan-06 21:35 
GeneralRe: Problem installing SQL server CE Pinmemberronithefrnd3-Jan-06 18:53 
Generalconnect to Sql server 2000 from Emulator PinmemberMr_NY22-Sep-05 18:05 
GeneralRe: connect to Sql server 2000 from Emulator Pinmemberrasheed19791-Jan-06 21:33 
GeneralRe: connect to Sql server 2000 from Emulator Pinmembertommyitvn4-Dec-06 15:46 
GeneralMySQL to SQL Server CE PinmemberSarunMK12-Jul-05 18:52 
GeneralRe: MySQL to SQL Server CE Pinmemberrasheed197913-Jul-05 22:42 
GeneralRe: MySQL to SQL Server CE PinmemberSarunMK14-Jul-05 21:51 
GeneralRe: MySQL to SQL Server CE Pinmembersurpatel7813-Mar-07 4:50 
Generalcould not connect with DB Pinmembersiddams6-Jul-05 21:45 
GeneralRe: could not connect with DB Pinmemberrasheed19798-Jul-05 10:38 
GeneralRe: could not connect with DB Pinmembersiddams11-Jul-05 20:34 
GeneralRe: could not connect with DB Pinmemberrasheed197912-Jul-05 1:07 
GeneralHelp....Help "Connect to server using CDMA connection" Pinmembersridhar14k1-Jul-05 16:50 
GeneralRe: Help....Help "Connect to server using CDMA connection" Pinmemberrasheed19794-Jul-05 7:59 
GeneralDataBinding PinmemberRossi4625-Jun-05 6:03 
GeneralRe: DataBinding Pinmemberrasheed19794-Jul-05 7:57 
GeneralStop - Start SQL Server CE Agent Services in PDA. PinmemberJomay123457-Jun-05 19:13 
Generalsync Pocket PC and Desktop PC Pinmemberadrian.zhelev12-May-05 1:11 
GeneralRe: sync Pocket PC and Desktop PC Pinmemberrasheed197912-May-05 23:41 
GeneralRe: sync Pocket PC and Desktop PC PinmemberAdnan Siddiqi7-Jul-05 1:10 
GeneralRe: sync Pocket PC and Desktop PC Pinmemberrasheed19798-Jul-05 10:40 
GeneralCan't Create DB PinmemberFerry Santoso10-May-05 17:17 
GeneralRe: Can't Create DB Pinmemberrasheed197910-May-05 23:56 
GeneralRe: Can't Create DB PinmemberMohdImranRizvi26128124-Nov-05 5:22 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150123.1 | Last Updated 30 Jan 2004
Article Copyright 2004 by rasheed1979
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid