//#define SERVER_OR_CLIENTusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Net.Sockets;using System.Data.SqlServerCe;using System.IO;using DataBaseCTLSpace;using System.Net;using System.Threading;using MobileSocketCTL;namespace SQLCEDataBaseCTL...{ public partial class Form1 : Form ...{ private DataBaseCTL CTL;#if SERVER_OR_CLIENT MobileSocketClient Client = new MobileSocketClient("192.168.0.244", "1234"); public void ClientReveiceD(int i, string s) ...{ this.textBox1.Text = s; }#else MobileSocketServer Server = new MobileSocketServer("192.168.0.113","1234"); public void ServerReveiceD(int i, string s) ...{ this.textBox1.Text = s; }#endif public Form1() ...{ InitializeComponent(); CTL = new DataBaseCTL("SQLCEDataBase", "TempSQLCE", "192.168.0.244", "sa", "", "SqlCEDataBase/SqlMobile"); CTL.CreateDatbase();#if SERVER_OR_CLIENT Client.ClientRevEvent += new MobileSocketClient.RevdataEvent(ClientReveiceD); Client.ClientConnectServer("Send OK!");#else Server.ServerRevEvent += new MobileSocketServer.RevdataEvent(ServerReveiceD); Server.SetupServer("Connect OK!");#endif } private void button1_Click(object sender, EventArgs e) ...{ this.Close(); } private void button2_Click(object sender, EventArgs e) ...{ this.Text = CTL.ExecuteSqlServer("insert into TableName(Address,Name) values(1,'" + textBox1.Text.Trim() + "')").ToString(); } private void button3_Click(object sender, EventArgs e) ...{ this.Text = CTL.DownloadTable("TableName").ToString(); } private void button4_Click(object sender, EventArgs e) ...{ this.Text = CTL.UPDateTable("TableName").ToString(); } private void button5_Click(object sender, EventArgs e) ...{ this.Text = CTL.ExecuteSqlLocal("update tablename set Address = 3 where Address = 1").ToString(); } private void button6_Click(object sender, EventArgs e) ...{#if SERVER_OR_CLIENT Client.ClientSendText(textBox1.Text.Trim());#else Server.ServerSendText(textBox1.Text.Trim());#endif } }}//http://192.168.0.244/SqlCEDataBase/SqlMobile/sqlcesa30.dll