SQL Server CE and the Dot Net Framework

Want to turn your Pocket PC into a .NET and database platform? This article will concentrate on how to use Visual Studio and the Smart Device Extensions to install SQL Server CE and the .NET Compact F

ITPro Today

March 23, 2003

3 Min Read
ITPro Today logo in a gray background | ITPro Today

Want to turn your Pocket PC into a .NET and database platform? This article will concentrate on how to use Visual Studio and the Smart Device Extensions to install SQL Server CE and the .NET Compact Framework to your PDA.Visual Studio Creation, The ProjectBrowse the Smart Device Extensions documentation, the SQL Server CE documentation, or Microsoft's Pocket PC documentation, you'll find several different instructions on how to install the various components on your system. In some cases, Microsoft says you need the Pocket PC SDK, or the Embedded Visual Tools to install SQL Server CE (not true). In other cases, the documentation tells you to copy dlls to the Windows folder on your device and register them with a batch file. However, that leaves you without the useful SQLCE Query Analyzer. I'll show you a quick and easy way to have Visual Studio automatically set up your device. First, open Visual Studio and select File -> New -> Project... Under Visual C# Projects, select Smart Device Application. If you do not see that option, verify that you have run the Smart Device Extensions install package. This will start the SDE Wizard. Select Pocket PC as your target platform, and Windows Application as your project type. When you are through with the Wizard, you should have a blank form, sized for the Pocket PC, in Visual Studio. Next, we are going to add a reference to the SQL Server CE assembly and by doing so, when deploying our project, Visual Studio will automatically install SQL Server CE for us if the device does not already have it installed. If you do not want SQL Server CE installed, skip this step. From the Project menu, select Add Reference. Highlight the System.Data.SqlServerCE assembly in the list, and press the Select button. Your dialog should look like the following:Deploying the Project itselfFrom the Build menu, select Deploy Solution. This will compile your project, and if successful, will prompt you asking which device to target. You have the option of deploying to a physical device, or the software emulator. If you do not have a physical device, using the emulator is a great way to get started. Once you have selected your particular option and clicked Deploy, Visual Studio will try to connect to your device. Depending on the machine, this could be a slow process, so be patient. Given this is beta software; on several occasions, I have had to deploy the application a second time, more so when using the emulator, in order to get a successful connection. Once Visual Studio connects, it will first check if the .NET Compact Framework is installed, as well as any assemblies referenced by your application. In our case, we have a dependency on SQL Server CE. Visual Studio will start installing the .NET Compact Framework, and then install SQL Server CE automatically! If you watch your device, you should see the install programs running, as seen below:Visual Studio should continue and load your dummy application to the device as well. You can close that, since we just created it for the purposes of getting Visual Studio to do a lot of work for us. To prove that SQL Server CE is installed, open the Start Menu on your device. You should see an option for SQLCE Query. This is the SQL Server CE Query Analyzer, which is a cross between SQL Server's Enterprise Manager and Query Analyzer. From here, you can create databases, tables, and run queries.This is a very helpful way of utilizing the programs and the PDA. You can download the extensions at the MSDN website.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like