// Connection String to the SQL Server.
        string rdaOleDbConnectString  = "Provider=sqloledb; Data Source=MySqlServer;Initial Catalog=Northwind; " +
                                        "User Id=username;Password = <password>"; 
                                      
        // Initialize RDA Object.
        SqlCeRemoteDataAccess rda = null;        try {
            //Try the Pull Operation.
            rda = new SqlCeRemoteDataAccess();
            
            rda.InternetLogin          = "MyLogin";
            rda.InternetPassword       = "<password>";
            rda.InternetUrl            = "<http://www.northwindtraders.com/sqlce/sscesa20.dll>";
            rda.LocalConnectionString  = @"Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\ssce.sdf";
           
            rda.Pull(
                "Employees", 
                "Select * from Employees", 
                rdaOleDbConnectString, 
                RdaTrackOption.TrackingOnWithIndexes , 
                "ErrorTable");
        }
        catch(SqlCeException) {
            //Use you own Error Handling Routine.
        }
        finally {
            //Dispose of the RDA Object.
            rda.Dispose();
        }
这是msdn中的一个例子,把sql server中的选定数据保存到本地的数据库ssce.sdf中

解决方案 »

  1.   

    // Connection String to the SQL Server.
            string rdaOleDbConnectString  = "Provider=sqloledb; Data Source=MySqlServer;Initial Catalog=Northwind; " +
                "User Id=username;Password = <password>"; 
                                          
            // Initialize RDA Object.
            SqlCeRemoteDataAccess rda = null;        try {
                //Try the Pull Operation.
                rda = new SqlCeRemoteDataAccess();
                
                rda.InternetLogin          = "MyLogin";
                rda.InternetPassword       = "<password>";
                rda.InternetUrl            = "<http://www.northwindtraders.com/sqlce/sscesa20.dll>";
                rda.LocalConnectionString  = @"Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\ssce.sdf";
               
                rda.Push("MyLocalTable", 
                    rdaOleDbConnectString, 
                    RdaBatchOption.BatchingOn);
            }
            catch(SqlCeException) {
                //Use you own Error Handling Routine.
            }
            finally {
                //Dispose of the RDA Object.
                rda.Dispose();
            } 这个是从本地数据库ssce.sdf传送回sqlserver
    参考 SqlCeRemoteDataAccess类
      

  2.   

    sorry,我不清楚条码枪是什么,我做的是pda的程序,我想应该差不多吧,
    我的程序都是操作本地数据库的,需要数据时用pull从连接的pc上的sqlserver中获得数据,对数据修改后再用push将修改后的数据传回,但是不能直接访问sqlserver,程序是在pda上执行的