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

Pocket PC with SQL CE

, 29 Jan 2004
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)

Introduction

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"

Background

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
  • SQLCEURL
  • 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=" & _
  oDBConfig.PublisherPassword

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

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

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

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

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, _
   RdaBatchOption.BatchingOn)        
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 | ;-)

History

  • First release 1.0

License

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

Share

About the Author

rasheed1979

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 5:01 
Generaldb connection error Pinmemberashuangrish27-Nov-08 21:44 
GeneralRe: db connection error Pinmemberrasheed197930-Nov-08 18:38 
GeneralRe: db connection error Pinmemberashuangrish1-Dec-08 0:53 
GeneralRe: db connection error Pinmemberashuangrish5-Dec-08 0:28 
GeneralRe: db connection error Pinmemberomid200223-Feb-09 8:05 
Generalhelp Rasheed :( Pinmemberthree.leaf12-Sep-08 12:46 
Generalphone incoming call information Pinmemberprats115-Jun-07 0:28 
GeneralE r r o r PinmemberPavan_pareta2-Jun-07 0:13 
Generalmissing method exception Pinmembermokhabarat3-May-07 12:21 
Generalsql express Pinmemberrajeshatsrin20-Apr-07 5:01 
QuestionError when synchronize data from Pocket PC to Pc and opposite Pinmembertommyitvn5-Dec-06 19:21 
AnswerRe: Error when synchronize data from Pocket PC to Pc and opposite Pinmemberrasheed197922-Dec-06 1:20 
GeneralMissing Method Exception Pinmembervictorarce7-Jul-06 6:56 
GeneralRe: Missing Method Exception Pinmemberstorystar31-Oct-06 8:57 
Generalrasheed..plz help Pinmembersudhacnaidu8-Jun-06 18:47 
GeneralRe: rasheed..plz help Pinmembersudhacnaidu9-Jun-06 0:21 
GeneralRe: rasheed..plz help Pinmemberrasheed197911-Jun-06 16:55 
Generalerror with initialize SQL Pinmembersudhacnaidu8-Jun-06 18:41 
GeneralBook PinmemberBaskras1214-May-06 2:58 
GeneralRe: Book Pinmemberacc12345678907-Mar-07 2:51 
GeneralNot able to Sync PinmemberArathi Vasupal26-Mar-06 23:45 
GeneralIs there away to send to Desktop Ms Access Pinmembersilkkeng7-Mar-06 16:19 
GeneralRe: Is there away to send to Desktop Ms Access Pinmemberrasheed197913-Mar-06 15:05 
GeneralProblem installing SQL server CE Pinmemberronithefrnd1-Jan-06 17:45 

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 | Mobile
Web02 | 2.8.140902.1 | Last Updated 30 Jan 2004
Article Copyright 2004 by rasheed1979
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid