Use SQLServerCompactEdition to create a mobile application

Source: Internet
Author: User
Tags microsoft sql server 2005
This walkthrough describes how to create an application in MicrosoftVisualStudio2005 using MicrosoftSQLServer2005CompactEdition. The SQLServerCompactEdition database will become the subscription server released by SQLServer2005, and will use the combined replication function from the SQLServer2005 Database

This walkthrough describes how to create an application in Microsoft Visual Studio 2005 that uses Microsoft SQL Server 2005 Compact Edition. The SQL Server Compact Edition database will become the subscription Server released by SQL Server 2005, and will be copied from SQL Server 2005

This walkthrough describes how to use MicrosoftSQL Server 2005 Compact EditionIn Microsoft Visual Studio 2005CreateApplicationProgram. The SQL Server Compact Edition database will be the subscription Server released by SQL Server 2005, and the information will be downloaded from the SQL Server 2005 database to the SQL Server Compact Edition database through combined replication.

  1. During this drill, you will perform the following steps:
  2. Configure SQL Server 2005 for release.
  3. Configure Internet Information Service (IIS) for copying.
  4.   CreateSubscribe to SQL Server Compact Edition.
  5.   CreateApplicationProgram.
  6. DeploymentApplicationProgramAnd test the subscription.

  Required items

To perform this drill according to the steps described in this drill, the following conditions must be met:

  • A computer with Windows XP and IIS installed.
  • SQL Server 2005 Service Pack 2 (SP2) or later, installed on the same computer as Visual Studio.

  SQL Server 2005 Task

InCreateApplicationProgramBefore, you must configure the release in SQL Server 2005. In the following stepsCreateA sample database, and then publish data from the database. You will use the pre-built script fileCreateDatabase, and then use the new release WizardCreateRelease.

  CreateDatabase and data Filling

1. Open SQL Server Management Studio.

2. When you are prompted to connect to the server, type "local" in "server name" and click "Connect ".

3. Open a new query window.CreateSQL Server Compact Edition database, and fill the database with data.

The following is a reference clip:
USE master;
GO
If exists (SELECT * FROM sys. sysdatabases WHERE name = 'sqlmobile ')
BEGIN
DROP Database SQLMobile;
END
GO
Create database SQLMobile;
GO
USE SQLMobile;
GO
Create table MembershipData (MemberID integer identity (1, 1)
CONSTRAINT pkMemberID primary key, MemberName NVarChar (50 ));
Create table FlightData (MemberID INTEGER FOREIGN KEY REFERENCES
MembershipData (MemberID), Destination NVarChar (50), FlightStatus
NVarChar (50), ArrivalDate DATETIME, FlownMiles INTEGER );
Insert into MembershipData (MemberName) VALUES ('Mr Don Hall ');
Insert into MembershipData (MemberName) VALUES ('Mr Jon Morris ');
Insert into MembershipData (MemberName) VALUES ('Ms TiAnna Jones ');
Insert into FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (1, 'seattle ', 'flight Delayed 1 hour', '2014/1/00', '20140901 ');
Insert into FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (2, 'London ', 'flight on time', '2014/1/00', '123 ');
Insert into FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (3, 'sydney ', 'flight Gate closing', '2014/1/00', '123 ');
Insert into FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (1, 'Tokyo ', 'delayed fog', '2014/1/00', '123 ');
Insert into FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (2, 'minapolis ', 'flight on time', '2014/1/00', '123 ');
Insert into FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (3, 'memphis ', 'flight Gate closing', '2014/1/00', '123 ');
GO

4. Click "execute (!)" Run the script andCreateDatabase. The script is run,CreateA new database named SQLMobile.

  Note:

You can also press F5 or select "execute" from the "query" menu to run the query.

5. To confirm that the database hasCreateIn the object Resource Manager, expand "(local)", expand "Database", and then expand "SQLMobile ". If the SQLMobile database is not listed. Right-click "Database" and select "refresh" to update the database list.

  Prepare the server to publish data

InCreateRequired before releaseCreateSnapshot proxy user account, andCreateA shared folder in which snapshot files will be stored. Prepare the server for release.CreateAfter the snapshot folder is created, the folder is used for all releases on the server. IfCreateYou can skip these steps.

  CreateSnapshot User Account

1. Open "Computer Management" from "Management Tools" on the "control panel ".

2. In computer management, expand system tools, expand local users and groups, right-click users, and select new users ".

3. In the "new user" dialog box, type the following information and click"Create":

  

Field Value

User Name

Snapshot_agent

Password

P @ ssw0rd

Confirm Password

P @ ssw0rd

The user must change the password upon next login

Not selected

Password Never Expires

Selected

  Important:

These settings should only be used for testing. In the production environment, make sure that the user account settings meet your network security requirements. Generally, you use a domain user account instead of a local user account for the snapshot proxy.

  CreateSnapshot folder

  1. In Windows resource manager,CreateA new folder named "snapshot. In this walkthrough, you can go to the root directory of drive CCreateThis folder is c: \ snapshot. Right-click the "snapshot" folder and select "share and security ".
  2. On the "share" tab, select "share this folder" and click "Permissions ".
  3. In "snapshot Permissions", click "add ".
  4. In "enter the name of the object to be selected", type computername \ snapshot_agent (computername is the name of the Local Computer), click "Check name", and then click "OK ".
  5. In "snapshot Permissions", select "snapshot_agent", assign "change" and "read" Sharing permissions, and click "OK ".
  6. Select the "Security" tab.
  7. Click Add ".
  8. In "enter the name of the object to be selected", type computername \ snapshot_agent (computername is the name of the Local Computer), click "Check name", and then click "OK ".
  9. Select "snapshot_agent" and add the "write" permission to the enabled permission list. Now, the snapshot_agent account is granted the following permissions:
  10. Read and execute
  11. List folder Directories
  12. Read
  13. Write
  14. Click OK to close the snapshot Properties window.
  15. Disable Windows Resource Manager.

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.