Windows mobile6.5 Development (2)-configure the environment, database access, and deploy simple instances

Source: Internet
Author: User

First, configure the development environment:

System Environment: Microsoft Windows XP Professional 2002 Service Pack 3

Install software:

1 Visual Studio 2008 RTM &. NET Framework Version 3.5 SP1 English version

2 ActiveSync 4.5 setup CHS

3 Windows Mobile 6 Professional SDK refresh. MSI

4 Windows Mobile 6 standard SDK refresh. MSI not required

5 Windows Mobile 6.5 professional developer Tool Kit (USA). MSI

6 Windows Mobile 6.5 standard developer Tool Kit (USA). MSI is not required

7 Windows Mobile 6.5.3 professional dtk. MSI

8 mobileformstoolkitenterprise.2010.msi (RESCO Control)

9 al6804.zip (patch for RESCO Control)

After the installation is complete, configure the development simulator environment:

1 ActiveSync settings: file-connection settings: allow connections to one of the following ports and select DMA

2 vs2008 menu tools-device emulator Manager-select Windows Mobile 6.3.5 professional wvgaemulator right-click Connect

Wait for Refresh, right-click cradle to create Synchronization

The synchronization setting wizard appears. Next, complete the wizard as needed.

3. Configure the simulator environment: install several cab packages:

Netcfv35.messages. En. WM. Cab

Netcfv35.wm. armv4i. Cab

Sqlce. Phone. wce5.armv4i. Cab installation takes precedence over the following two

Sqlce. Dev. enu. Phone. wce5.armv4i. Cab

Sqlce. REPL. Phone. wce5.armv4i. Cab

Syncservices. WM. Cab

2. Create an example program:

File-new project: smart device project: myfirstwmproject

Select Windows Mobile 6 Professional SDK and. NET Framework compact version 3.5

Project type: Device Application

1. First create an SQL ce database:

Tools-connect to database-add connecttion

Data source: Microsoft SQL Server compact3.5

Click Create, Click Browse, select the project path, and then modify the Database Name: testdb.

The result is similar to: D: \ workspace \ myfirstwmproject \ testdb. SDF.

Enter the access password: 123456

In the Server Explorer window, operate on new databases, create tables, and columns.

Testtb: contains an auto-increment ID column and a name column.

Right-click the table show table data and add several pieces of data.

2. Drag and Drop a button and a DataGrid on the page, and write the code in the click Time of the button.

Add references add system. Data. sqlserverce reference, and

Using system. Data. sqlserverce;

Code of the button click event:

String Spath = system. Io. Path. getdirectoryname (system. reflection. Assembly. getexecutingassembly (). getname (). codebase. tostring ());

Sqlceconnection conn = new sqlceconnection ("Data Source =" + Spath + "\ testdb. SDF; Password = '000000 '");

Sqlcedataadapter da = new sqlcedataadapter ("select * From testtb", Conn );

Datatable dt = new datatable ();

Conn. open ();

Da. Fill (DT );

Conn. Close ();

Datagrid1.datasource = DT;

The Code has been compiled.

Three deployment projects: two methods

Method 1: Copy files directly

Directly copy the myfirstwmproject.exe file and the database file testdb. SDF generated by the project to the same folder in the simulator.

Similar: Copy to \ My Documents \ business

Then go to the simulator, select file explorer in the menu, and enter the business folder, you can see the two files

Select myfirstwmproject and press enter to start the program. click the button to obtain the displayed data.

Method 2: Create the cab installation package

Add new project: other project types: smart device cab Project

Project name: mysmartdevicecab

Right-click Application folder and choose add-add project output.

Select primary output

Right-click Add-add file again and select the database testdb. SDF file.

On File System on target machine, right-click Add-add special folder and choose Start Menu folder.

Select the folder, display the form in the file on the right, right-click Create New Folder cut, select the main output file under the ication folder, click OK, and right-click the file you just created, change the name to myfirstwmproject, which is the name of the shortcut on the start page in the future.

Delete useless Program Files Folder folders

Build a project to generate a cab file package

Copy the generated cab package file to the simulator and click Install. After installation, the shortcut myfirstwmproject appears.

Click the shortcut to access the program.

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.