I'm working on a Windows CE application, and I need to copy server table data to SQL Server CE database (local) using C# programming. I'm using Visual Studio 2008, SQL Server 2008 for the development.
Below is the code I'm working with, but it seems in VS2008 SqlBulkCopy isn't supported. Do we have any alternatives to achieve this functionality?
SqlConnection source = new SqlConnection(Con_s);// server connection string SQL Server
SqlCeConnection destination = new SqlConnection(Con_l);// Local connection string SQL Server CE DB
SqlCeCommand cmd = new SqlCeCommand("DELETE FROM ProductList", destination);
source.Open();
destination.Open();
cmd.ExecuteNonQuery();
cmd = new SqlCommand("SELECT * FROM Products", source);
SqlDataReader reader = cmd.ExecuteReader();
SqlBulkCopy bulkData = new SqlBulkCopy(destination);
bulkData.DestinationTableName = "ProductList";
bulkData.WriteToServer(reader);
bulkData.Close();
destination.Close();
source.Close();
Add: I have included both using System.Data.SqlClient; & using System.Data; in the code

SqlCeConnectionandSqlCeCommand!!SqlBulkCopyis only for "real" SQL Server (Express and others) - but NOT for the Compact Edition (which is really a totally different, separate product). But maybe this project on CodePlex could be of help to you