程序如下:
private void GetDownDataBase()
{
string localDatabase=@"\chun.sdf";
string localconntiomstring = "Data Source=" + localDatabase;
string remoteConnectionString = @"Provider=sqloledb;" +
"Data Source=chun;Initial Catalog=chun;" +
"Integrated Security=SSPI;";
string[] tables = new string[] { "student", "scouse" };
if (File.Exists(localDatabase))
File.Delete(localDatabase);
SqlCeEngine engine = new SqlCeEngine(localconntiomstring);
engine.CreateDatabase();
using (SqlCeRemoteDataAccess rda = new SqlCeRemoteDataAccess())
{
rda.InternetUrl = " http://chun/server/sscesa20.dll";
rda.LocalConnectionString = localconntiomstring;
foreach (string table in tables)
{
try
{
rda.Pull(table, "SELECT* FROM [" + table + "]", remoteConnectionString, RdaTrackOption.TrackingOffWithIndexes, "ErrorTable");
}
catch (SqlCeException ex)
{
MessageBox.Show(ex.Message + ex.InnerException,"天伦软件提示!" );
}
}
}
}
在IE中输入 http://chun/server/sscesa20.dll测试是正确的..请高手指点.....
QQ:112223304谢谢......
private void GetDownDataBase()
{
string localDatabase=@"\chun.sdf";
string localconntiomstring = "Data Source=" + localDatabase;
string remoteConnectionString = @"Provider=sqloledb;" +
"Data Source=chun;Initial Catalog=chun;" +
"Integrated Security=SSPI;";
string[] tables = new string[] { "student", "scouse" };
if (File.Exists(localDatabase))
File.Delete(localDatabase);
SqlCeEngine engine = new SqlCeEngine(localconntiomstring);
engine.CreateDatabase();
using (SqlCeRemoteDataAccess rda = new SqlCeRemoteDataAccess())
{
rda.InternetUrl = " http://chun/server/sscesa20.dll";
rda.LocalConnectionString = localconntiomstring;
foreach (string table in tables)
{
try
{
rda.Pull(table, "SELECT* FROM [" + table + "]", remoteConnectionString, RdaTrackOption.TrackingOffWithIndexes, "ErrorTable");
}
catch (SqlCeException ex)
{
MessageBox.Show(ex.Message + ex.InnerException,"天伦软件提示!" );
}
}
}
}
在IE中输入 http://chun/server/sscesa20.dll测试是正确的..请高手指点.....
QQ:112223304谢谢......
博主在开发PDA应用过程中遇到数据无法从IIS服务器同步的问题。具体表现为程序尝试连接远程数据库并下载数据时,出现请求失败的情况。尽管通过浏览器可以直接访问指定的URL并确认其正确性。
1021

被折叠的 条评论
为什么被折叠?



