コード例 #1
0
        private void BeginSynchronize(SqlCeReplicationHelper.ReinitializeOption option)
        {
            try
            {
                txtStatus.Text    = string.Empty;
                btnSync.IsEnabled = false;

                bool useNt = comboBox1.SelectedIndex == 1;
//#if DEBUG
//                txtUrl.Text = "http://erik-pc/ssce35sync/sqlcesa35.dll";
//                txtPublisher.Text = "Erik-PC";
//                txtPublisherDatabase.Text = "PostCodes";
//                txtPublication.Text = "PubPostCodes";
//                txtSubscriber.Text = "ERIK-PC";
//#endif
                _replHelper = new SqlCeReplicationHelper(DatabaseInfo.ConnectionString, txtUrl.Text, txtPublisher.Text, txtPublisherDatabase.Text, txtPublication.Text, txtSubscriber.Text, txtHostname.Text, useNt, txtInternetUsername.Text, txtInternetPassword.Password, txtPublisherUsername.Text, txtPublisherPassword.Password, IsNew, option);

                _replHelper.Completed += replHelper_Completed;
                _replHelper.Progress  += replHelper_Progress;
                _replHelper.Synchronize();
            }
            catch (Exception ex)
            {
                btnSync.IsEnabled = true;
                Helpers.DataConnectionHelper.SendError(ex, DatabaseInfo.DatabaseType, false);
            }
        }
コード例 #2
0
        private void BeginSynchronize(SqlCeReplicationHelper.ReinitializeOption option)
        {
            try
            {
                txtStatus.Text    = string.Empty;
                btnSync.IsEnabled = false;

                bool useNT = false;
                if (comboBox1.SelectedIndex == 1)
                {
                    useNT = true;
                }

                //txtUrl.Text = "http://erik-pc/ssce35sync/sqlcesa35.dll";
                //txtPublisher.Text = "Erik-PC\\SQL2008R2";
                //txtPublisherDatabase.Text = "PostCodes";
                //txtPublication.Text = "PubPostCodes";
                //txtSubscriber.Text = "ERIK-PC";

                replHelper            = new SqlCeReplicationHelper(this.Database, txtUrl.Text, txtPublisher.Text, txtPublisherDatabase.Text, txtPublication.Text, txtSubscriber.Text, txtHostname.Text, useNT, txtInternetUsername.Text, txtInternetPassword.Password, txtPublisherUsername.Text, txtPublisherPassword.Password, IsNew, option);
                replHelper.Completed += new SqlCeReplicationHelper.CompletedHandler(replHelper_Completed);
                replHelper.Progress  += new SqlCeReplicationHelper.ProgressHandler(replHelper_Progress);
                replHelper.Synchronize();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Helpers.DataConnectionHelper.ShowErrors(ex));
            }
        }