|
SqlCeRemoteDataAccess问题
[复制链接]
下面代码是复制Microsoft网站上改的
[url=http://msdn.microsoft.com/zh-cn/library/system.data.sqlserverce.sqlceremotedataaccess(VS.80).aspx][/url]
- // Connection String to the SQL Server
- //
- string rdaOleDbConnectString = "Data Source=ziyu;Initial Catalog=test; " +
- "User Id=sa;Password=123456";
- // Initialize RDA Object
- //
- SqlCeRemoteDataAccess rda = null;
- //try
- {
- // Try the Pull Operation
- //
- rda = new SqlCeRemoteDataAccess(
- "http://192.168.1.240/ce/sqlcesa30.dll",
- "MyLogin",
- "",
- "Data Source=MobileService.sdf");
- rda.Pull("sale", "SELECT * FROM sale", rdaOleDbConnectString,
- RdaTrackOption.TrackingOnWithIndexes, "ErrorTable");
- MessageBox.Show("ok");
- // or, try one of these overloads:
- //
- // rda.Pull("Employees", "SELECT * FROM DimEmployee", rdaOleDbConnectString,
- // RdaTrackOption.TrackingOnWithIndexes);
- //
- // rda.Pull("Employees", "SELECT * FROM DimEmployee", rdaOleDbConnectString);
- }
- //catch (SqlCeException)
- {
- // Handle errors here
- //
- //MessageBox.Show("Err");
- }
- //finally
- {
- // Dispose of the RDA object
- //
- rda.Dispose();
- }
复制代码
错误代码:
+ $exception {"无法使用给定的连接字符串打开 SQL Server。 [ connect string = Data Source=ziyu;Initial Catalog=test; User Id=sa;Password=123456 ]"} System.Exception {System.Data.SqlServerCe.SqlCeException}
|
|