Click here to Skip to main content
13,196,946 members (62,246 online)
Click here to Skip to main content
Add your own
alternative version

Stats

213.3K views
476 downloads
44 bookmarked
Posted 29 Jan 2004

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" ;-)

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

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralMy vote of 2 Pin
Rob Graham5-May-09 5:01
memberRob Graham5-May-09 5:01 
Generaldb connection error Pin
ashuangrish27-Nov-08 21:44
memberashuangrish27-Nov-08 21:44 
GeneralRe: db connection error Pin
rasheed197930-Nov-08 18:38
memberrasheed197930-Nov-08 18:38 
GeneralRe: db connection error Pin
ashuangrish1-Dec-08 0:53
memberashuangrish1-Dec-08 0:53 
GeneralRe: db connection error Pin
ashuangrish5-Dec-08 0:28
memberashuangrish5-Dec-08 0:28 
GeneralRe: db connection error Pin
omid200223-Feb-09 8:05
memberomid200223-Feb-09 8:05 
Generalhelp Rasheed :( Pin
three.leaf12-Sep-08 12:46
memberthree.leaf12-Sep-08 12:46 
Generalphone incoming call information Pin
prats115-Jun-07 0:28
memberprats115-Jun-07 0:28 
GeneralE r r o r Pin
Pavan_pareta2-Jun-07 0:13
memberPavan_pareta2-Jun-07 0:13 
Generalmissing method exception Pin
mokhabarat3-May-07 12:21
membermokhabarat3-May-07 12:21 
Generalsql express Pin
rajeshatsrin20-Apr-07 5:01
memberrajeshatsrin20-Apr-07 5:01 
QuestionError when synchronize data from Pocket PC to Pc and opposite Pin
tommyitvn5-Dec-06 19:21
membertommyitvn5-Dec-06 19:21 
AnswerRe: Error when synchronize data from Pocket PC to Pc and opposite Pin
rasheed197922-Dec-06 1:20
memberrasheed197922-Dec-06 1:20 
GeneralMissing Method Exception Pin
victorarce7-Jul-06 6:56
membervictorarce7-Jul-06 6:56 
GeneralRe: Missing Method Exception Pin
storystar31-Oct-06 8:57
memberstorystar31-Oct-06 8:57 
Generalrasheed..plz help Pin
sudhacnaidu8-Jun-06 18:47
membersudhacnaidu8-Jun-06 18:47 
GeneralRe: rasheed..plz help Pin
sudhacnaidu9-Jun-06 0:21
membersudhacnaidu9-Jun-06 0:21 
GeneralRe: rasheed..plz help Pin
rasheed197911-Jun-06 16:55
memberrasheed197911-Jun-06 16:55 
Generalerror with initialize SQL Pin
sudhacnaidu8-Jun-06 18:41
membersudhacnaidu8-Jun-06 18:41 
GeneralBook Pin
Baskras1214-May-06 2:58
memberBaskras1214-May-06 2:58 
GeneralRe: Book Pin
acc12345678907-Mar-07 2:51
memberacc12345678907-Mar-07 2:51 
GeneralNot able to Sync Pin
Arathi Vasupal26-Mar-06 23:45
memberArathi Vasupal26-Mar-06 23:45 
GeneralIs there away to send to Desktop Ms Access Pin
silkkeng7-Mar-06 16:19
membersilkkeng7-Mar-06 16:19 
GeneralRe: Is there away to send to Desktop Ms Access Pin
rasheed197913-Mar-06 15:05
memberrasheed197913-Mar-06 15:05 
GeneralProblem installing SQL server CE Pin
ronithefrnd1-Jan-06 17:45
memberronithefrnd1-Jan-06 17:45 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171019.1 | Last Updated 30 Jan 2004
Article Copyright 2004 by rasheed1979
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid