sql-server-ce

Connection to Read-only embedded SQL Server compact edition (.sdf file) in WPF application

天涯浪子 提交于 2020-01-06 20:24:15
问题 I am looking for a solution to the following: Find a properly formatted connection string to SQL server compact edition file (.sdf) used as embedded resource, containing reference (i.e. read-only) data in WPF application. Note: please pay attention to the operative words [ Build Action ] set to " Embedded Resource " and " Do Not Copy " to the output directory settings. It means that the file will not be physically copied to the target computer as a stand-alone entity, but instead is embedded

Why does creating a SQLServer Compact table in Server Explorer not create an .SDF file on disk?

随声附和 提交于 2020-01-06 15:19:02
问题 I created an .sdf database in Visual Studio 2008 (not programmatically - using the MS Access-like wizard); I can see it, along with the one table that's in it, and that table's columns, in the Server Explorer, yet my project failed on trying to access it, saying the file did not exist - true, it doesn't! In fact, nowhere on the hard drive. How could that be? Where is it? How can I get what I see in Server Explorer to be written to disk? 回答1: A SQL Server Compact file always exists on disk 来源:

Select distinct where date is max

家住魔仙堡 提交于 2020-01-06 04:03:27
问题 This feels really stupid to ask, but i can't do this selection in SQL Server Compact (CE) If i have two tables like this: Statuses Users id | status | thedate id | name ------------------------- ----------------------- 0 | Single | 2014-01-01 0 | Lisa 0 | Engaged | 2014-01-02 1 | John 1 | Single | 2014-01-03 0 | Divorced | 2014-01-04 How can i now select the latest status for each person in statuses? the result should be: Id | Name | Date | Status -------------------------------- 0 | Lisa |

declare variables in sql ce

夙愿已清 提交于 2020-01-06 01:51:25
问题 I am tryin to get records from a table within a month in sql compact edition. Here is the sql query I know: DECLARE @startDate as DATETIME, @EndDate as DATETIME @startDate = GetDate(); @ENdDate = DATEADD(m,1,@startDate) select * from table where (columnname between @startdate and @enddate) I know that you have to send one script at a time, but how can you declare variables in sql ce(I guess it doesn't accept declare)? 回答1: I think my answer is very late for this question, but hope it will be

Update not taking effect on SQLCe 3.5 with dataset and table adapters

寵の児 提交于 2020-01-05 08:48:05
问题 We used the VS2010 data connection design wizard to define a connection to a SQLCe database with just one table (database="UserMetrics" table="User"). Try as we might the update doesn't seem to hold, I've been through posts on SO and MSDN but can't see the glaring error... //initialize UserMetricsDataSet umDataSet = new UserMetricsDataSet( ); UserMetricsDataSetTableAdapters.UserTableAdapter umTableAdapter = new UserMetricsDataSetTableAdapters.UserTableAdapter( ); // check that test data is

How to Export Data from SQL server Compact To Access MDB

99封情书 提交于 2020-01-05 08:17:47
问题 I need a solution to transfer all data from SQL Server CE to Access mdb database. I tried this approach http://www.codeproject.com/Answers/483989/HowplustoplusExportplusSQLplusTablesplusToplusAcce#answer2 (solution # 2) but getting an error "No database specified in connection string or IN clause." The code works if I connect to non-compact SQL server. I guess the problem is with connection string in IN clause but I cannot figure out how to change it. Here is my code: private void ExportTable

SQL Server CE - Select random rows

孤街醉人 提交于 2020-01-05 07:07:19
问题 How do you select a random rows from a table? For example, if there are 1000 rows in a table matching the criteria that I want, I want to select just 20 random ones. Like TOP, but random. Thanks, and this is for SQL Server CE 3.5! 回答1: How about this? SELECT TOP(20) * FROM myTable ORDER BY NEWID() 回答2: How about SELECT * FROM tbl_name ORDER BY RAND() LIMIT 0,20; However if your db is with million rows Both newid() and rand() would perform slow. There is a faster solution .Read this 来源: https:

Finding rank of the student -Sql Compact

痞子三分冷 提交于 2020-01-05 04:02:07
问题 I have a table like this : Name Mar1 Mar2 Mar3 Total xxx 80 80 80 240 yyy 60 70 50 180 aaa 85 65 75 225 I wanted to find the rank of the student based on total. I using SQL Compact 3.5 . As we have rank() function in sql server do we have something with which we can find the students rank??? When I used "select Total,rank() over (order by total desc) i1 from stmarks " it's giving error as " Major Error 0x80040E14, Minor Error 25501 select Total,rank() over (order by total desc) i1 from

Need to save a lot of records for my application… should I use a local database instad?

泄露秘密 提交于 2020-01-04 15:26:39
问题 I am about to start developing a "time machine" for windows. I need to store a lot of records in a table. Every time I perform a backup I will write about 50,000 records because that's how many files I have in my computer (each records has nothing to do with storing a file. the record will contain the path where each file is located) Anyways I don't know if I could use XML to store my records since my queries are not going to be complicated plus it is easier to deploy versus creating a local

Entity SQLCE Can't find connection string in app.config file

*爱你&永不变心* 提交于 2020-01-04 04:14:27
问题 I've been getting this error when I try and use my model container: No connection string named 'PFModelContainer' could be found in the application config file. I have my edmx file in a separate project. I checked the app.config file and my model was there, and I also put it in my main project app.config file. Still doesn't work. Here's the connection string: <connectionStrings> <add name="PFModelContainer" connectionString="metadata=res://*/PFModel.csdl|res: //*/PFModel.ssdl|res://*/PFModel