sql-server-ce

How do I specify that a property should generate a TEXT column rather than an nvarchar(4000)

走远了吗. 提交于 2019-11-27 07:56:52
I'm working with the Code First feature of Entity Framework and I'm trying to figure out how I can specify the column data types that should be created when the database is auto-generated. I have a simple model: public class Article { public int ArticleID { get; set; } public string Title { get; set; } public string Author { get; set; } public string Summary { get; set; } public string SummaryHtml { get; set; } public string Body { get; set; } public string BodyHtml { get; set; } public string Slug { get; set; } public DateTime Published { get; set; } public DateTime Updated { get; set; }

How to connect SQL Server Compact Edition database to Crystal Report in C#

折月煮酒 提交于 2019-11-27 07:24:59
问题 I'm trying to connect my SQL Server Compact Edition database to Crystal Report. I've been searching all day long and I've found many question related to it so far on other websites, but none had a working answer. I also found this question in this site which has asked for VB.Net solution. And this link which is all over the internet and has a confusing way to do it by XML, which I couldn't figure it out. There are other links with solutions in SQL Server and Access which don't help. SQL

C# 4.0/EF - Server-generated keys and server-generated values are not supported by SQL Server Compact

元气小坏坏 提交于 2019-11-27 07:08:07
问题 I have just moved one of my projects into VS2010/fx4.0 and am using a SQL CE database as the backing store. Since moving it to this version of .NET I am now getting this error: Server-generated keys and server-generated values are not supported by SQL Server Compact. My table was defined with a PK of UserName (string) & DoorOpen (datetime) as SQLCE required there be a PK on every table in fx3.5. Now that I am in fx4.0 I am stumped. I've googled for this and every answer I found was: SQLCE

Can I use SQL Server Compact Edition CE on Mono?

寵の児 提交于 2019-11-27 06:56:56
问题 Does anyone know if I can use SQL Server Compact Edition 3.5 on mono? I'm hoping they are written as managed assemblies and will work ok..does anyone have any experience? 回答1: All of the SQL Compact (except System.Data.SqlCe.dll obviously) are native libraries, so no they won't work under non-Windows platforms. 回答2: Pretty replacement for SQL CE is SQLite SQLite ADO.NET Provider is portable and exists on Microsoft.NET and Mono http://sqlite.phxsoftware.com http://www.mono-project.com/SQLite

Isn't an Int64 equal to a long in C#?

两盒软妹~` 提交于 2019-11-27 06:35:03
问题 I have been playing around with SQL and databases in C# via SqlCeConnection. I have been using ExecuteReader to read results and BigInt values for record IDs which are read into Longs. Today I have been playing with SQL statements that use COUNT based statements ('SELECT COUNT(*) FROM X') and have been using ExecuteScalar to read these single valued results. However, I ran into an issue. I can't seem to store the values into a Long data type, which I have been using up to now. I can store

sqlbulkcopy using sql CE

一曲冷凌霜 提交于 2019-11-27 04:25:44
Is it possible to use SqlBulkcopy with Sql Compact Edition e.g. (*.sdf) files? I know it works with SQL Server 200 Up, but wanted to check CE compatibility. If it doesnt does anyone else know the fastest way of getting a CSV type file into SQL Server CE without using DataSets (puke here)? 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

Using SQL Server CE 4 on a remote host with MVC 3

狂风中的少年 提交于 2019-11-27 04:16:36
问题 I just upgraded my host to MVC 3 but I'm trying to do a "hello world" using SQLCE 4.0 but I just got: Sorry, an error occurred while processing your request. I see my layout and everything but instead of data I see that. On localhost is working as expected I have: <add name="PruebaContext" connectionString="Data Source=|DataDirectory|db.sdf" providerName="System.Data.SqlServerCE.4.0"/> as connectionString. I put the sdf as part of the project, I added the System.Data.SqlServerCE.dll to the

%APPDATA% in connection string is not substituted for the actual folder?

Deadly 提交于 2019-11-27 03:27:29
问题 When using WPF and entity-framework I have an APP.CONFIG that looks like the following: <?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> <add name="DatabaseEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlServerCe.4.0;provider connection string="Data Source=%APPDATA%\Folder\Database.sdf"" providerName="System.Data.EntityClient" /> </connectionStrings> </configuration> When using this code it always

Bulk Insert In SQL Server CE

拟墨画扇 提交于 2019-11-27 02:54:57
问题 i am new at SQL Server CE and using Visual Studio 2008, SQL Server CE 3.5. I want to know that what the best way of inserting bulk records into SQL Server CE database? Does BULK INSERT statement work for SQL Server CE? I have nearly 45 tables and some of these tables should have large amount of data. Using command.Prepare is enough or is there more efficient and fast way? 回答1: SQL CE does not have a bulk insert command. For the best raw performance opening a an updateable SqlCeResultset using

Create SQLCE database programmatically [duplicate]

我们两清 提交于 2019-11-27 02:38:51
问题 This question already has answers here : Create SQL Server CE database file programmatically (2 answers) Closed 6 years ago . [EDITED - with answer] Following is my code to create SQL CE database programmatically: /* get the Path */ var directoryName = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var fileName = System.IO.Path.Combine(directoryName, "Foo2Database.sdf"); /* check if exists */ if (File.Exists(fileName)) File.Delete(fileName); string connStr = @"Data