⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 使用C#开发的基于windows mobile的数据同步框架
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlServerCe;

namespace SyncData
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            ErrMsg msg = RdaTools.createDb();
            if (msg.result)
            {
                msg = RdaTools.createTbl();
                MessageBox.Show(msg.msg);                
            }
            else
            {
                MessageBox.Show(msg.msg, "err");
            }
            Cursor.Current = Cursors.Default;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            ErrMsg msg = RdaTools.pullAll("sampletb");
            MessageBox.Show(msg.msg);
            Cursor.Current = Cursors.Default;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            ErrMsg msg = RdaTools.pullChange("sampletb");
            MessageBox.Show(msg.msg);
            Cursor.Current = Cursors.Default;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            SqlCeConnection conn = null;
            try
            {
                conn = new SqlCeConnection(RdaTools.connStr);
                conn.Open();
                string result = RdaTools.getDataChange("sampletb", conn);
                if (result == null)
                {
                    MessageBox.Show("本地没有数据修改");
                }
                else
                {
                    MessageBox.Show("修改过的数据主键为:" + result);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("err:" + ex.Message);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            Cursor.Current = Cursors.Default;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -