= new SqlCeEngine();
private SqlCeRemoteDataAccess rda = new SqlCeRemoteDataAccess();
窗体加载项
private void Form1_Load(object sender, EventArgs e)
{
this.dbFile = this.AppPath + @"\" + this.dataBaseName;//数据库
string str = "DataSource=" + this.dbFile;
this.con.ConnectionString = str;//终端数据库配置
this.rda.InternetLogin = "";//访问IIS代理服务器的用户
this.rda.InternetPassword = "";//访问IIS代理服务器的密码
this.rda.InternetUrl = this.internetURL;//服务器数据库配置
this.rda.LocalConnectionString = str;//终端数据库配置
}
下载
private void btnPull_Click(object sender, EventArgs e)
{
try
{
this.ExecuteSql("drop table gdinfos");//先要删除本地数据表如果存在的话,否则会报错
int tickCount = Environment.TickCount;
this.rda.Pull("gdinfos", "select * from gdinfos", this.remoteConStr, RdaTrackOption.TrackingOnWithIndexes);
int num2 = Environment.TickCount - tickCount;
MessageBox.Show(string.Format("下载成功\n用时{0}毫秒", num2));
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
上传
private void btnPush_Click(object sender, EventArgs e)
{
try
{
int tickCount = Environment.TickCount;
this.rda.Push("gdinfos", this.remoteConStr);
int num2 = Environment.TickCount - tickCount;
MessageBox.Show(string.Format("上传成功\n用时{0}毫秒", num2));
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
|