sqlbulkcopy using sql CE

BULKCOPY is not supported in SQL CE. Here is the fastest way if you have a huge number of rows in your table; insert is too slow! using (SqlCeConnection cn = new SqlCeConnection(yourConnectionString)) { if (cn.State == ConnectionState.Closed) cn.Open(); using (SqlCeCommand cmd = new SqlCeCommand()) { cmd.Connection = cn; cmd.CommandText = “YourTableName”; cmd.CommandType = CommandType.TableDirect; … Read more

How can I update a cell value in a dB table, using SQL Server CE and C# (Visual Studio 2010)

You have to tell us exactly what connection string you are using, saying things like “I updated the connection to point to the database in the bin folder” is not helpful. Are you using a connection string like c:\Users\Me\Visual Studio 2010\Projects\MyProject\bin\debug\HKRMoviesDB.sdf? That is not right, that is hard-coded to your VS2010 debug test folder on … Read more

How do I read the current path of |DataDirectory| from config settings

|DataDirectory| does not come from config settings; you’re mixing up three different things: ConfigurationManager.AppSettings[“DataDirectory”] This comes from config settings; a .config file you have to create and put into your project. This particular setting is the value of the element with key “DataDirectory” in the AppSettings element. This doesn’t exist unless you put one in … Read more

Is SQL Server Compact discontinued from Visual Studio 2013?

Yes, SQL Server Compact has been deprecated (see the comments on this Connect item). You should be using SQL Server Express or SQL LocalDB. Some posts: http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx http://blogs.msdn.com/b/jerrynixon/archive/2012/02/26/sql-express-v-localdb-v-sql-compact-edition.aspx http://erikej.blogspot.com/2011/01/comparison-of-sql-server-compact-4-and.html http://erikej.blogspot.com/2012/07/the-state-and-near-future-of-sql-server.html

Why saving changes to a database fails?

It is a quite common problem. You use the |DataDirectory| substitution string. This means that, while debugging your app in the Visual Studio environment, the database used by your application is located in the subfolder BIN\DEBUG folder (or x86 variant) of your project. And this works well as you don’t have any kind of error … Read more