Pages

Create a Windows Mobile Database application Using Microsoft Visual studio 2008

In this article i'll show you how to create a windows mobile device application using MVS 2008.
but first you need to know some basics..
simply click this link to get some basic knowledge.......
http://dummiestutorials.blogspot.com/2010/09/create-simple-windows-mobile.html

Before creating the application you need to know some basics about SQL Server Compact. Because you use SQL Server Compact as your database.

SQL Server Compact 3.5

  • Data Stored in .sdf file
  • Create amd manage this database using SQL Server Management studio or Visual Studio
  • No Stored Procedure and views

First launch the visual studio 2008 and select New -> Project -> Smart Device  and give the project name as MobileDatabaseApp and click OK.

Select Target Platform as Windows mobile 6 Professional SDK and select Device application and click OK.


After that you need to create a Database file for this. To do that in Menu select Data -> Add New DataSource  and you will get Data Source configuration wizard ....


Select Next.. In the Data Source configuration wizard select New connection . And Add connection window appears. Choose the data source as Microsoft SQL server Compact 3.5(.NET Framework)
In here you can create a Database or you can browse existing database.So i choose browse because i use sample Northwind database.




After choose the Database click the Test Connection. If it tells Test Connection Succeed that means you successfully config the database.Otherwise it will show a error message.


After that click Next. In here you can select the tables that you want. For the demo i select Customers table and click finish. It will ask that you want to copy the database to your app and select yes.
Now you will get something like this
(Check solution explorer Northwind DB is there)

Now simply drag and drop Customer table that appear in Data sources to Form1. After that select grid properties(Right click grid-> Preperties )
In properties select Table styles and click the (...)

After you select it you will get this..

Click GridColumnStyles (...).. after that remove additional Members and keep Members you want.. Select OK


After that Select Generate Data Forms like this....

Finally you will get the form and MVS2008 automatically create two additional forms for you.

Click the debug button and you will get the output..

You can download Sample Project Application
http://hotfile.com/dl/70497068/721f746/MobileDatabaseApp.rar.html

3 comments: