sql-server-ce

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

雨燕双飞 提交于 2019-11-27 02:17:46
I'm writing a small application for college, a video rental application. I have no problems reading from the database, but I cannot update the data in the tables. In particular I'm looking to update the cell showing the quantity of a film in stock after someone rents a movie. So far I've been trying this: string updateDVDs = "UPDATE Products SET dvd_quantity = " + product.Quantity + " WHERE title = '"+ product.Name +"';"; cmdUpdateDVDs = new SqlCeCommand(updateDVDs, dBConnection); dBConnection.Open(); cmdUpdateDVDs.ExecuteNonQuery(); dBConnection.Close(); I don't get any errors, but the cell

Delete parent with children in one to many relationship

隐身守侯 提交于 2019-11-27 02:17:14
问题 I have a .NET4.0 application with Entity Framework 5.0 e Sql Server CE 4.0. I have two entities with a one to many (parent/child) relationship. I've configured it to cascade delete on parent removal, but for some reason it doesn't seem to work. Here is a simplified version of my entities: public class Account { public int AccountKey { get; set; } public string Name { get; set; } public ICollection<User> Users { get; set; } } internal class AccountMap : EntityTypeConfiguration<Account> {

SQL LocalDB vs SQL Server CE

亡梦爱人 提交于 2019-11-27 01:30:51
问题 I have a small project that will have 1 user on 1 computer. The database will be rather small (probably less than 1 mb of data). I plan to use WPF and Entity Framework for that project. I came up with 2 potential database solutions for my project : SQL Server CE and SQL Server Express LocalDB (with SQL Server 2012). I have never worked with any of those, I'm more used to work with the full SQL Server 2008 installation. I also want it to be easy to install on the client. Ideally I'd like to

Connection string with relative path to the database file

六月ゝ 毕业季﹏ 提交于 2019-11-27 00:56:32
I load data from sdf database in winforms App. I use full path to the database file . Example : conn = new SqlCeConnection { ConnectionString ="Data Source=F:\\My Documents\\Project1\\bin\\Debug\\Database.sdf" }; I d like use a relative path to the database file. For example. I have sdf file in folder F:\My Documents\Project1\bin\Debug\Data\file.sdf and I want use relative path in connection string. Any advice ? Thank you. Nime Cloud Relative path: ConnectionString = "Data Source=|DataDirectory|\Database.sdf"; Modifying DataDirectory as executable's path: string executable = System.Reflection

How to connect to SQL Server from another computer?

怎甘沉沦 提交于 2019-11-27 00:45:54
I want to connect from home using SQL Server 2005 to another PC. I had a look on the msd...but before connecting it says I should connect to another computer using the computer management and it didn't work out....I can only connect to computers from my workgroup? Thanks, Luisa If you want to connect to SQL server remotly you need to use a software - like Sql Server Management studio. The computers doesn't need to be on the same network - but they must be able to connect each other using a communication protocol like tcp/ip, and the server must be set up to support incoming connection of the

Using Entity Framework with an SQL Compact Private Installation

大兔子大兔子 提交于 2019-11-27 00:03:41
I am using Entity Framework 4 in a desktop application with SQL Compact. I want to use a private installation of SQL Compact with my application, so that my installer can install SQL Compact without giving the user a second installation to do. It also avoids versioning hassles down the road. My development machine has SQL Compact 3.5 SP1 installed as a public installation, so my app runs fine there, as one would expect. But it's not running on my test machine, which does not have SQL Compact installed. I get this error: The specified store provider cannot be found in the configuration, or is

Running SQL Server CE 4 Queries with Visual Studio 2012 and SQL Server Management Studio 2012

廉价感情. 提交于 2019-11-26 23:38:04
问题 I have recently upgraded to Visual Studio 2012 and SQL Server Management Studio 2012, however I cannot seem to see how to execute SQL scripts (created by Entity framework) on a SQL Server CE 4.0 database. With VS2010 + SSMS 2008 the Transact-SQL editor would ask for a connection and you could browse to the object, however this option is not available in SSMS 2012. I have tried to execute the script via the Server Explorer -> New Query window, but I get parse errors. Any clues? 回答1: Microsoft

SQL Server CE in a multi user scenario - is this really, really stupid?

醉酒当歌 提交于 2019-11-26 20:40:18
问题 I am trying to use SQL Server Compact Edition 3.5 as a database backend for a sales application. There would be 3-4 installations of a Windows Forms application which would all (via LINQ2SQL) read from and write to one .sdf file located on a network share. My (pretty inextensive) testing has shown that this could be viable. Documentation states that SQL Server CE supports up to 256 connections. Does SQL Server CE even lock its rows? Are there other concurrency issues that I should worry about

How to deploy SQL Server Compact Edition 4.0?

懵懂的女人 提交于 2019-11-26 19:33:48
How do i deploy Microsoft SQL Server Compact 4.0 ? SQL Server Compact Edition (currently at version 4.0) is: a free, embedded database that software developers can use for building Windows desktop applications. It has a small footprint and supports private deployment of its binaries within the application folder. But how do you actually deploy it? Microsoft says it can be deployed within the application folder ( good ) and supports xcopy deployment . Microsoft also says it cannot be deployed within the application folder ( bad ), and does not support xcopy deployment . some people have

Create SQL Server CE database file programmatically

断了今生、忘了曾经 提交于 2019-11-26 19:11:14
问题 How can I create a new SQL Server Compact database file (.sdf) programmatically, without having an existing template file to copy from? 回答1: There is some good info here: Create a SQL Server Compact Edition Database with C# string connectionString = "DataSource=\"test.sdf\"; Password=\"mypassword\""; SqlCeEngine en = new SqlCeEngine(connectionString); en.CreateDatabase(); 回答2: First, go click on the Browse tab. Now navigate to C:\Program Files\Microsoft SQL Server Compact Edition\v3.1 . Now