Click here to Skip to main content
12,998,654 members (129,731 online)
Click here to Skip to main content
Add your own
alternative version


46 bookmarked
Posted 18 Feb 2005

Administrate SQL Server2000 from Pocket PC

, 18 Feb 2005
Rate this:
Please Sign up or sign in to vote.
This article demonstrates administrating SQL Server 2000 from Pocket PC on the fly.

Sample Image - AdminSQLfromPocketPC.jpg


I am a little crazy about writing mobile applications using .NET CE. This article describes about administrating SQL Server 2000 from Pocket PC with the help of Web Services. Using web service I can administrate SQL Server 2000 on the fly.

Client Requirements.

  1. Pocket PC with Microsoft Windows CE powered.
  2. Microsoft .NET Compact Framework 1.0.

Server Requirements.

  1. Microsoft .NET framework 1.1.
  2. MS SQL server 2000 with SP3 or above.
  3. IIS 5.0.


Sometime I might away from my SQL Server or I might have be traveling somewhere. In that time, I thought about how could I control my SQL Server from there. Then I got an idea why not to try with a Pocket PC. When I stated doing the application, I faced problem in connecting to my remote SQL Server from Pocket PC. Then I look around and thought web service might be the right solution. I used web service as middle tire to interconnect my Pocket PC and SQL server. Finally, I am able to achieve that.

This is a beginning. In this, we can connect to SQL Server and manipulate query processes like how we do in Query analyzer.

In future version, I am planning to do like Desktop Enterprise Manager. If you can help me to achieve this, then you are most welcome.

Using the code

Download the source code as ZIP file. Unzip it, and in that you can find two folders named WSSQLsrv2000 and ControlSQLsrv2000.

WSSQLsrv2000 folder contains Web services, which will be consumed by the Pocket PC. Open Internet Information Services Manager (IIS) create a virtual folder under the Default Web Site directory. Set the physical file location as WSSQLsrv2000 folder path. Give write permission to the Virtual folder.

Find creating virtual folder details over here.

ControlSQLsrv2000 folder contains Windows CE application. You can compile and execute it in Emulator or deploy it in your Pocket PC.

When you execute the Pocket PC application you will be prompt for SQL server details to connect.

When you click on connect, the following code will be executed.


    UpdateStatus("Connecting to the database...");
    oLoginInfo.sServer = txtServerName.Text;
    oLoginInfo.sLoginName = txtLoginName.Text;
    oLoginInfo.sPassword = txtPassword.Text;
    oLoginInfo.sDatabase = "";
    ConnectDB oConDb = new ConnectDB();
    if (oConDb.fnConnect(txtServerName.Text ,txtLoginName.Text ,txtPassword.Text))
       frmMain ofrmMain = new frmMain();
       UpdateStatus("Not Connected..."); 

The following code in Web service will be executed.

[WebMethod] public bool fnConnect(string sDataSource, string sUserid, 
                                                     string sPassword)
   //To check the connection status with given details
   oLoginInfo.sServer = sDataSource;
   oLoginInfo.sLoginName = sUserid;
   oLoginInfo.sPassword = sPassword;
   oLoginInfo.sDatabase = "";
   if (oCon.fnConnectStatus(oLoginInfo))
     //Save the details if the connection status is true for further manupulation
     return true;
     //Connection failed in various reasons
     return false;

ConnectDB is a class written in web service. Here we are creating the object to that class and consuming its Web method fnConnect(). When this function is called, the web services receive the request and connects to the SQL server. Once the connection was success then the application will show the Server details.

We can populate the databases in two ways.

  1. Select Databases, tap and hold for few seconds and a pop up menu will appear with two options Refresh and Query Analyser. In that Select Refresh.

    Populate Database 1

  2. Select Database and select File -> Refresh From the main menu.

    Sample screenshot

Once you select the refresh option, the entire databases will be listed. Select the Database which you want to manipulate and choose the Query Analyser option based on the above two methods. Once you select it you will be redirected to another screen.

Main menu details

  1. Refresh – Reload all the databases under the server.
  2. Query Analyser – Select particular database under Databases Directory and do query manipulation by selecting this option.
  3. Re-Login – Exit from current server and login into different server.
  4. Exit – Exit and close the application.

In that text box enter the query you want to execute. For example, type

Select * from authors

Select the statement to execute. And tap on run to execute the statement. The results will be populated in the grid.

The results will be populated like this:


Points of interest

When you deploy the web service in your local PC, you have to change the URL from http://localhost to http://<ipaddress> in reference.cs under WSSQLsrv2000 folder. Otherwise the Pocket PC can’t consume the service.

You can find some of my articles over here.


Initial version 0.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

You may also be interested in...

Comments and Discussions

Generalweb error Pin
cathy200718-Mar-08 18:38
membercathy200718-Mar-08 18:38 
QuestionRasheed1979, Pin
naimish.s4-Nov-07 23:28
membernaimish.s4-Nov-07 23:28 
Questionport 1433 and pocket pc Pin
q_lozano4-Sep-07 11:50
memberq_lozano4-Sep-07 11:50 
Generalpda not connect Pin
GVerris7-Aug-07 12:24
memberGVerris7-Aug-07 12:24 
QuestionError when Add web reference Pin
yummy_yummy6-Apr-07 14:29
memberyummy_yummy6-Apr-07 14:29 
GeneralGot WebException after make a connection Pin
PrasertHong26-Mar-07 22:51
memberPrasertHong26-Mar-07 22:51 
Generalconnect with my protal database - mysql Pin
surpatel7810-Mar-07 2:20
membersurpatel7810-Mar-07 2:20 
GeneralRe: connect with my protal database - mysql Pin
rasheed197920-Mar-07 0:38
memberrasheed197920-Mar-07 0:38 
QuestionConnect from PPC to SQL SERVER 2000/2005 (On desktop) Pin
thesking31-Jan-07 2:22
memberthesking31-Jan-07 2:22 
AnswerRe: Connect from PPC to SQL SERVER 2000/2005 (On desktop) Pin
surpatel7810-Mar-07 2:19
membersurpatel7810-Mar-07 2:19 
Questionsecurity Pin
diana_01_kdr19-Jan-06 5:38
memberdiana_01_kdr19-Jan-06 5:38 
QuestionWill Bluetooth work for it ?? Pin
ronithefrnd30-Dec-05 18:30
memberronithefrnd30-Dec-05 18:30 
AnswerRe: Will Bluetooth work for it ?? Pin
rasheed19791-Jan-06 20:41
memberrasheed19791-Jan-06 20:41 
Generalerror when deploy to pocket pc Pin
diana_01_kdr20-Dec-05 22:38
memberdiana_01_kdr20-Dec-05 22:38 
GeneralRe: error when deploy to pocket pc Pin
rasheed197922-Dec-05 17:14
memberrasheed197922-Dec-05 17:14 
Questionsql server ce &amp; wifi Pin
diana_01_kdr19-Dec-05 6:43
memberdiana_01_kdr19-Dec-05 6:43 
AnswerRe: sql server ce &amp;amp; wifi Pin
rasheed197919-Dec-05 17:23
memberrasheed197919-Dec-05 17:23 
GeneralAbout Application Pin
Ali Gungormez20-Jul-05 6:51
sussAli Gungormez20-Jul-05 6:51 
Generalhelp me how to build such applications Pin
virgo*11-Jul-05 8:23
membervirgo*11-Jul-05 8:23 
GeneralRe: help me how to build such applications Pin
rasheed197912-Jul-05 0:05
memberrasheed197912-Jul-05 0:05 
Generalhep me develop such application Pin
virgo*11-Jul-05 8:08
membervirgo*11-Jul-05 8:08 

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
Web02 | 2.8.170622.1 | Last Updated 19 Feb 2005
Article Copyright 2005 by rasheed1979
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid