sql-server-ce

SQL compact 4 exception

不羁的心 提交于 2019-12-11 06:37:27
问题 I have a windows form application written in C# and running on a Windows XP machine with SQL compact 4 database. The operating system language is simplified chinese. I'm facing a strange exception. "The specified locale is not installed on this machine. Make sure you install the appropriate language pack. LCID 1053" Why? The application does work ok on all other configurations/languages. 回答1: That is the locale for Sweden. You can change the locale by modifying the connection string: http:/

problem with date in sql CE

那年仲夏 提交于 2019-12-11 06:35:26
问题 i have sqlCE DataBase, i have Tdate field (datetime) i notice that his format is: MM/DD/YYYY in my C# program i work with date in: DD/MM/YYYY format. how i can insert to my sqlCE data base my C# format ? 回答1: i have Tdate field (datetime) i notice that his format is: MM/DD/YYYY No, the datetime field doesn't have any format. The format is determined when the datetime value is converted into a string after reading it from the database. The same works when you insert a datetime value in the

SQLCE 4 - EF4.1 Internal error: Cannot open the shared memory region

女生的网名这么多〃 提交于 2019-12-11 06:19:22
问题 Hi im trying to run my MVC 3 application running SQLCE 4 embedded and EF4.1 i have used the data access methods as described in this tutorial This works perfectly locally(obviously), but when running it on my hosting i get the below error message. It is a shared hosting enviroment. Is it an open connection that is the problem? Shouldn't it be handled by the unit of work class that is returning the dbcontext as a singleton throughout the whole application as mentioned in the tutorial? Any tips

Does SQL Server Compact (CE) support a RequiresNew transaction scope inside another one?

回眸只為那壹抹淺笑 提交于 2019-12-11 05:59:14
问题 Here's a very simple example using SQL Server CE 3.5 SP1 where I attempt to use a new transaction inside an existing one. using (var db = new MyDataContext(<connection string>)) using (var ts = new TransactionScope()) { db.Thing.InsertOnSubmit(new Thing()); db.SubmitChanges(); using (var ts2 = new TransactionScope(TransactionScopeOption.RequiresNew)) { db.Thing.InsertOnSubmit(new Thing()); db.SubmitChanges(); // exception here ts2.Complete(); } [... do more stuff ...] ts.Complete(); } This

How to use SqlCeParameterCollection?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 05:42:16
问题 I wanna to know exactly how we do these thing on C# .NET 4.0 Form Application: Declaring SqlCeParameterCollection Object Adding Parameters to the collection Add the Collection to the Command Here are samples of my current code: Declaring & Adding SqlCeParameterCollection Parameters = new SqlCeCommand().Parameters; Parameters.Add("username", Username); Parameters.Add("password", Password); Now how to add this collection at once to the command? Thanks 回答1: Try this: string query = "...(whatever

How can I determine what version SQL Server Compact a table is?

微笑、不失礼 提交于 2019-12-11 05:36:15
问题 I have some .SDF tables that are created in a Windows CE app (access table data is passed from a server app, and this is converted into SQL Server Compact records/tables). I want to look inside them from my desktop machine in Visual Studio 2010. But attempting to create a new Data Connection in the Server Explorer, selecting either of the two "Microsoft SQL Server Compact" Data sources (3.5 and 4.0) fails. When I choose 3.5 and then "Test Connection," it tells me: This is not a valid SQL

The connection object can not be enlisted in transaction scope

家住魔仙堡 提交于 2019-12-11 05:28:27
问题 I am using TransactionScope to test database actions. This is the test class: // Test class private TransactionScope _transactionScope = null; [TestInitialize] public void Initialize() { _transactionScope = new TransactionScope(); } [TestCleanup] public void Cleanup() { if (_transactionScope != null) { _transactionScope.Dispose(); _transactionScope = null; } } [TestMethod] [DeploymentItem("Db.sdf")] public void AddToPresentationsTest() { var item = TestItem(); var db = new DbEntities(); var

Workaround with 'Column Name is not valid'

时间秒杀一切 提交于 2019-12-11 05:10:14
问题 Hi is there any workaround with this one? SELECT invoices.no, customers.name, invoices.mdcode, SUM(iproducts.unitprice * iproducts.quantity) AS total, SUM(iproducts.unitprice * iproducts.quantity) - SUM(rinvoices.payment + rinvoices.discount) AS [Remaining Balance] FROM invoices INNER JOIN customers ON customers.id = invoices.customerid INNER JOIN iproducts ON invoices.id = iproducts.invoiceid LEFT OUTER JOIN rinvoices ON invoices.id = rinvoices.invoiceid WHERE ([Remaining Balance] <> '0')

SQL to SQL CE: How to read an SQL or Access database and write it out as SQL CE database?

五迷三道 提交于 2019-12-11 05:08:46
问题 I have just one simple table in my MS SQL database (or Microsoft Access). How do I read in this table and write it out as an SQL CE database? I have both Visual Studio and WebMatrix installed so I can use either of these tools if required. Thanks. Is it possible to copy and paste one table to another? This would be the simplest if it works. 回答1: Try my Visual Studio add-in, allows you to migrate from SQL Server to SQL Server Compact: http://sqlcetoolbox.codeplex.com - command line walkthrough

INSERT statement affects 1 row, but the VS Server Explorer shows that it doesn't actually update the SQL CE database

不打扰是莪最后的温柔 提交于 2019-12-11 04:54:58
问题 I've checked other Stack Overflow questions to find answers, but I just can't find a solution to this. I am trying to insert string data into a SQL CE (local database). I can read from the database, but I cannot insert data, regardless of whether I hard-code it or try to add it with parameters. The table to be modified is called users . It has 3 columns: ID , name , email . Here is the code I am using: string connection = Properties.Settings.Default.LocalDBConnectionString; using (var con =