Windows moblie database materials

Source: Internet
Author: User
Tags how to use sql server how to use sql
Combined with the PDAs in the national dam basic database collection terminal developed several days ago Program The development process makes a summary of the Program on the smart device developed by vs2008.

1 program structure
The program contains four parts:
1. System Configuration

This part is used to configure related parameters in the system, including database information and serial port configuration information. The main technologies in this section are reading and writing XML files.

2. Data download

Download data from the database to the PDA, and save the data on the PDA also uses the database. This part of technology is mainly used to develop and enable mobile databases on PDA devices and to connect PCs with PDAs.

3. Data upload

The same technology as 2 is used to upload data from a PDA to a PC database.

4. GPS Data Acquisition

Use the external Bluetooth GPS module to obtain the longitude and latitude of the current location, and save the latitude and longitude in the mobile database on the PDA. Technologies involved include reading serial data and parsing GPS data.

2 Development Environment
Software environment: Visual Studio 2008

PC database: SQL Server

Smart devices: Windows Mobile 6

3. Establish a project
3.1 create a project
The process of creating a project is the same as that of creating another project in vs. In vs2008, choose "file-create-project" to create a new project.

Vs2008 has integrated the development environment of smart devices. Based on different development languages, select "smart devices" in different development language trees. Enter the project name in the name below, click "OK" to create a program project for the smart device.

3.2 establish a debugging environment
Vs2008 has included the simulation program of smart devices. The program can be debugged through the simulation program on the PC without having to debug the program one by one on the PDA.

After creating a project, set the debugging content on the devices page in "Project-Project Properties.

In the drop-down box, select the type of the target device. The type selection should be determined based on the PDA operating system. If the PDA is a Chinese operating system, select the "CHS" hitting option. For more information, see the PDA operating system. If you do not know the content in the options, please refer to other materials.

The selection and setting of simulation programs are not only in this way, but can also be set through "tool-device simulator manager" in vs2008.

3.3 draw a form
The form of a smart device is not very different from that of a Windows Device. After you select to add a form in the project, the screen-like template of PDA appears in. Drag the corresponding control in the toolbox to the template. Development of this part is no different from development of common Windows programs.

The difference is the menu. There is a default menu in the smart device menu, that is, there is a menu control at the bottom of the screen, you can add a menu by adding a menu item. Note that there can be only two level-1 menus, and you can only set the menu items on the left before setting the menu items on the right.

Controls are also strictly restricted. Controls that can be used in vs2008 are distributed in "All device controls V2", "Public device controls V2", "device container V2", "device menus and toolbar V2", and "device data" of the Toolbox. v2, V2, and V2 ". The method of using controls is no different from that of Windows Forms.

4. debugging
The method of debugging a program is not much different from that of a common program, but also through the single-step debugging and other functions. The only difference is that the program runs in the simulator during debugging.

4.1 other files
During debugging, if the program has only one EXE file and does not involve other files, it can be directly run in the simulation program. However, if the program has other files, you need to deploy the files to the PDA simulator. To deploy other files, follow these steps:

1. Use the "file-configuration..." menu on the simulator ..." Set the shared folder in the menu.

Click the following button to browse the disk on the computer and select the appropriate directory. After the shared folder is set, it will be used as an extended storage space for the PDA simulator. The shared folder in the simulator is named "storage card ". Then, you can directly operate files in the shared folder in the simulator.

At this time, you can copy other program-related files to the desired place. The following uses an XML file as an example. The XML file and the executable program of the program are in a directory to save the set parameters of the program. The XML file is on the computer, and the directory of the XML file is specified by reading the directory of the executable program. However, unfortunately, during the running process of the simulator, the executable program of EXE is considered to be in the directory "Program Files" "project name", which is the path in the simulator, the XML file cannot be found. In this case, you need to place the XML file under the "Program Files" "project name" directory.

In the simulator, click Start-Resource Manager and select storage card ". In this example, select a file through directory-file, and click "menu-edit-Copy" below to copy the file.

Then, find "My device-program files-project name" through the file-directory function on the Simulator Interface and enter the directory named by project name, use "file-edit-paste" to copy the file to the running directory where the executable program is located.

5. Mobile Database
In this project, Microsoft SQL Server mobile compact editor 3.5 is used. Other databases have not been used. This document only describes how to use SQL Server mobile compact editor 3.5.

5.1 obtain SQL Server mobile compact editor 3.5
SQL Server mobile compact editor 3.5 can be downloaded directly from Microsoft's website at: http://www.microsoft.com/downloa... P; displaylang = ZH-CN

Download the package and install it on your computer. Installed in C: "Program Files" Microsoft SQL Server compact edition by default.

Version 3.5 is the latest version, and the database file Password setting function is added. You can also use another version of SQL Server mobile.

5.2 use SQL Server mobile in SQL Server Manager Studio

In the logon section, select "SQL Server mobile" as the server type, and select "Browse more..." as the database file in the drop-down list ..." Select the created database file, or select "New Database" in the form to create a new database.

Enter the Database Password to log on to the SQL Server mobile database. It must be noted that the database created in MySQL 3.5 may not be logged on in SQL Server manage Studio 2005.

5.3 create a data table in the SQL Server Mobile Database
You can create tables in SQL Server mobile by using the table creation wizard in SQL Server manage Studio 2005 or by using SQL statements. When creating a table, note that the field types are different from those in SQL Server. The field types that can be used in SQL Server may not be available in SQL Server mobile, note This when creating a table.

5.4 deploy SQL Server mobile databases on smart devices
Copy the created database file to the corresponding simulator directory in the way described in 4.1. At this time, the simulator can connect to and operate the SQL Server mobile database.

However, if you use a PDA to access SQL Server mobile, note that Windows Mobile does not contain a database engine and requires four additional packages. If these four packages are not installed, the program cannot connect to and read the SQL Server mobile database.

These four packages are under the SQL Server mobile installation directory, specifically C: "Program Files" Microsoft SQL Server compact edition "v3.5" devices "wce500" armv4i directory, including:

Sqlce. Dev. CHS. PPC. wce5.armv4i. Cab

Sqlce. PPC. wce5.armv4i. Cab

Sqlce. REPL. PPC. wce5.armv4i. Cab

Sqlce. wce5.armv4i. Cab

Copy the four files to the simulator and install them.

After installation, three programs are added to the PDA program: sqlservercompact 3.5 repl

Sqlservercompact 3.5 tools CN

Sqlservercompact 3.5 Core

When you do not need to move the database, you can uninstall these three programs.

6. Connect a smart device to operate a PC database
There are two ways for smart devices to operate PC databases:

One is wireless connection, and the other is USB connection to the computer. Wireless connections are generally insufficient in general environments, and are often connected through a USB data cable. When using a USB data cable to connect to a PC, you need to install a synchronization tool. Currently, Microsoft ActiveSync is widely used;

Http://www.microsoft.com/downloa... P; displaylang = ZH-CN

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.