Solved

Converting SQL database to a sdf file

Posted on 2003-10-30
2
923 Views
Last Modified: 2011-10-03
I have a SQL database and I store all the information on that. I want this database to be accessed from pocket pc's. For this reason I had to convert all my database to a *.sdf file format so that the pocket pc user may use it.
I need a code on c#.net which can provide me a sdf file from SQL database.
0
Comment
Question by:burakbaysal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
russellshome earned 500 total points
ID: 9648575
0
 
LVL 8

Expert Comment

by:Dishan Fernando
ID: 9648616
/// Creating the replication object
SqlCeReplication oRepl = new SqlCeReplication(
      txtInternetUrl.Text, //@"http://10.20.10.81/SSCEGateway20/sscesa20.dll"
      txtInternetUserName.Text,
      txtInternetPassword.Text,
      txtPublisher.Text, // server name
      txtPublisherDatabase.Text,
      txtPublication.Text,
      txtSubscriber.Text,
      "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\My Documents\db.sdf"
      );

// Setting the HostName to the same value as the Subscriber for
// dynamic filtering on SQL Server
oRepl.HostName = txtSubscriber.Text;

/// Checking if a subscriber database already exists
if (!System.IO.File.Exists( txtSubscriberConnection.Text ) )
{
      /// Subscriber database does not exist. So creating a new
      /// subscription database
      oRepl.AddSubscription(AddOption.CreateDatabase);

}// end if

/// Performing the merge synchronization
oRepl.Synchronize();
      
MessageBox.Show("Sync Complete!");

/// Disposing the replication object
oRepl.Dispose();
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

634 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question