sql-server-ce

Is this an example of LINQ-to-SQL?

这一生的挚爱 提交于 2019-12-24 17:15:38
问题 I made a little WPF application with a SQL CE database. I built the following code with LINQ to get data out of the database, which was surprisingly easy. So I thought "this must be LINQ-to-SQL". Then I did "add item" and added a "LINQ-to-SQL classes" .dbml file, dragged my table onto the Object Relational Designer but it said, "The selected object uses an unsupported data provider." So then I questioned whether or not the following code actually is LINQ-to-SQL, since it indeed allows me to

How do I populate a SQL Server Compact database?

ぃ、小莉子 提交于 2019-12-24 12:15:39
问题 So I'm building a windows app, and as a result, I'm going to use SQL Server Compact instead of the normal SQL Server as I figure it can then be run on any computer, not just one with SQL Server installed. The problem is from what I've seen, you can't seem to do any scripting in SQL Compact, you can't declare variables, you can only do one statement at one time. I generally have like a reference data script stored that I run everytime I rebuild the database. Is this possible in Compact? The

Can't connect to my SQL Server database?

泪湿孤枕 提交于 2019-12-24 11:20:03
问题 I'm creating a very basic CRUD desktop winforms application in C#/.NET 4.0. Letting Visual Studio auto-generate the fields for the table I'd like to perform my CRUD operations on works just fine, but I'm running into problems when I try and interact with it manually with my own SQL queries. The auto-generated fields are using the connection string: Data Source=|DataDirectory|\Data Analysis.sdf If I try and do: SqlConnection conn = new SqlConnection(@"Data Source=|DataDirectory|\Data Analysis

Entity Data Model Wizard not showing Microsoft SQL Server Compact 3.5 in vs 2012

北战南征 提交于 2019-12-24 10:57:40
问题 I have SQL Compact 3.5 edition for which I am trying to generate an EDMX file using the Entity data model wizard. I am using Visual Studio 2012 Beta Ultimate. I am trying to generate a Model (generate from the database). I create a new connection, selecting the change data source. Here I am not able to see Microsoft SQL Server Compact 3.5 database file. But I could see this in VS 2010. How do I do to create an entity model with SQL CE 3.5 and Visual Studio 2012? 回答1: SQL Server Compact 3.5 is

How would I duplicate the Rank function in a Sql Server Compact Edition SELECT statement?

家住魔仙堡 提交于 2019-12-24 10:49:10
问题 It doesn't look like SQL Server Compact Edition supports the RANK() function. (See Functions (SQL Server Compact Edition) at http://msdn.microsoft.com/en-us/library/ms174077(SQL.90).aspx). How would I duplicate the RANK() function in a SQL Server Compact Edition SELECT statement. (Please use Northwind.sdf for any sample select statements, as it is the only one I can open with SQL Server 2005 Management Studio.) 回答1: SELECT x.[Product Name], x.[Unit Price], COUNT(y.[Unit Price]) Rank FROM

Select time from datetime in SQL Compact

若如初见. 提交于 2019-12-24 10:47:36
问题 Much like this question: "How to get Time from DateTime format in SQL?", I am trying to select only the time from a datetime, but unlike the above question, I would like to know how to do it in SQL Server Compact . Does anyone know how to do this? 回答1: SELECT DATEPART(hour, OrderDate), DATEPART(minute, OrderDate) FROM MyOrders Ref. http://msdn.microsoft.com//library/ms173998%28v=sql.90%29.aspx 回答2: Solved it. Luigi's answer is not actually the correct one but I have upvoted it, as it helped

Thread Safe way to access SQL CE Database

落爺英雄遲暮 提交于 2019-12-24 09:27:18
问题 Background: In my windows phone project. I use local SQL CE database to store date. The create the database tables using LINQ to SQL programmatically. This database is accessed through various datacontext instances in couple of threads. Here's the issue: I give an option to the user of my app to erase all the data and logout. When the user selects this, I delete the database using the datacontext's DeleteDatabase method. But, I always receive the error that the database is being used by

Can't connect to SQL Server CE database

℡╲_俬逩灬. 提交于 2019-12-24 08:28:36
问题 I have the following code, just to test connection: public void Test() { SqlCeConnection conn = new SqlCeConnection(@"Data Source=/Application/Database.sdf;"); try { conn.Open(); label1.text = "Connection!"; } catch (Exception ee) { label1.text = "No connection!"; } } When trying to connect to this database, the application throws an exception at conn.Open() saying SqlCeException was unhandled and nothing more. The exception message is blank, so I'm having a hard time figuring out what went

Does SQL CE ExecuteResultSet need to be cleaned up?

*爱你&永不变心* 提交于 2019-12-24 07:25:45
问题 I have a table with about 150 rows in it. These are the data types in the table: int (PK) nvarchar(52) tinyint datetime uniqueidentifier nvarchar(300) bit bit bit bit I download the data from a web service and insert into the database. When I do that it works fine. I later in the execution of my program I call the web service again. Since I may have updated some of the data I downloaded the first time, I check the db to see the row has changed. If it has then I leave it, if not then I update

Why the SQL Server CE 4 data connection is not listed in the DataConnection combo when I want to generate Database from Model?

依然范特西╮ 提交于 2019-12-24 02:25:09
问题 I am doing some tests with Entity Framework using SQL server CE 4 CTP2 and VS2010 Pro. I can create the data Connection without problems (as administrator) and see the information of the sample database NorthWind.sdf. However when I create a new model (for example persons) and I attempt to generate it into the database NorthWind.sdf using the "generate Database Wizard", I can't see the connection related to "Microsoft SQL Server Compact 4". Only Microsoft SQL Server, Microsoft SQL Server