sql-server-ce

SQL Compact 4.0 can't open/read sdf file

十年热恋 提交于 2019-11-30 17:19:14
I've installed SQL Compact 4.0 CTP 2 via WPI and used NUPack to add SQLCE.EntityFramework in my project. It compiles and run perfectly but I can't open the SDF file in Visual Studio 2010's Server Explorer. When I try I always receive the following message: Microsoft Visual Studio This is not a valid SQL Server Compact Database file or this file version is not supported by current SQL Server Compact Engine. OK I've already tried to uninstall and reinstall everything. It cannot be opened in SQL Server 2008 R2 Management Studio also. Please help!! Installing this (Visual Studio 2010 SP1 Tools for

SQL Server CE - Internal error: Cannot open the shared memory region

六眼飞鱼酱① 提交于 2019-11-30 17:03:13
问题 I have a SQL Server CE database that works fine in dev, but when installed on the client has an issue. The SQL Server CE 3.5 dependencies are copied as part of the deployment. The target machine is a clean Windows 7 32-bit Ultimate image. The message for the exception in the event log is: Message: Internal error: Cannot open the shared memory region. Stack Trace: at System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr) at System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent)

NTEXT with more than 4000 characters in SQL Server CE in Windows Phone

别等时光非礼了梦想. 提交于 2019-11-30 16:28:19
NTEXT with more than 4000 characters in SQL Server CE in windows phone I have a database in my windows phone app with a ntext field in one of the tables, I'm trying to write some content to this field, but I get an InvalidOperationException with the message: String truncation: max=4000, len=4621 I am trying to use ntext because I know that nvarchar doesn't accept more than 4000 chars. I've searched for a solution but I couldn't find any. The only solution I found I cannot use on windows phone, because it uses the SqlConnection and SqlCommand with SqlDbType . Here is how the columns is declared

ASP.NET MVC3 Code-First Error- attempting to update entity

妖精的绣舞 提交于 2019-11-30 16:00:25
问题 I've checked this question and it seems to be related to what I need, but does not answer it exactly. I have an entity (Sql Compact using EF Code First via MVC3- if that wasn't clear from the title) for an "Issue" (generic issue tracking, just for my own education understanding of how MVC3 works). The Issue class has a CreatedBy property (Int reference to a User who Created the Issue) and a CreatedDate property (DateTime). When I use the scaffolded code to update (modified only to prevent

How to Move a Tracked File to Untracked using Visual Studio Tools for Git

最后都变了- 提交于 2019-11-30 14:11:06
Started experimenting with git. Inadvertently added all the files in the project to "Included Changes" in Team Explorer. I committed all in an initial commit. One of those files was the SQL CE 4.0 (file-based) database. I clearly goofed there. I do not want to track the database nor do I want to end up restoring the db back to some previous point. My problem is I have no idea of how to move the SQL CE 4.0 sdf file from included changes to untracked. I am not experienced with git and all I know to date is what is afforded to me in the Team Explorer UI. So, how do I move a file from (committed

Local DB throws Byte array truncation to a length of 8000 exception

烂漫一生 提交于 2019-11-30 08:31:17
问题 I'm trying to take a snapshot from a Map control as a WritableBitmap, convert it to a byte array and save it in the local DB. It works fine (I can convert the byte array back to the image) untill I submit the changes to the DB. At this point it throws an exception "Byte array truncation to a length of 8000". I didn't find any documentation about byte array limitation. Does anyone know how to increase the limit of 8000? My byte array is a member of my Model: private byte[] _locationImage;

How to use parameter with LIKE in Sql Server Compact Edition

谁说我不能喝 提交于 2019-11-30 08:26:40
问题 I'm trying to parameterise a search query that uses the LIKE keyword with a wildcard. The original sql has dynamic sql like this: "AND JOB_POSTCODE LIKE '" + isPostCode + "%' " So I've tried this instead, but I get a FormatException: "AND JOB_POSTCODE LIKE @postcode + '%' " Edit: I guess the FormatException isn't going to be coming from Sql Server CE, so as requested, here is how I set the parameter in my C# code. The parameter is set in code like this: command.Parameters.Add("@postcode",

SQL Server queries case sensitivity

ぃ、小莉子 提交于 2019-11-30 08:25:23
I have this database: abcDEF ABCdef abcdef if I write: select * from MyTbl where A='ABCdef' how to get: ABCdef and how to get: abcDEF ABCdef abcdef Thanks in advance forgot to write - sqlCE You can make your query case sensitive by making use of the COLLATE keyword. SELECT A FROM MyTbl WHERE A COLLATE Latin1_General_CS_AS = 'ABCdef' gbn If you have abcDEF, ABCdef, abcdef already in the database then it's already case sensitive or you have no constraint. You'd have to add a COLLATE on both sides to make sure it's truly case sensitive (for a non case sensitive database) which will invalidate

Create .mdf/.sdf database dynamically

爷,独闯天下 提交于 2019-11-30 06:58:30
How can I with "code" create a new .mdf/.sdf database? I've tried this: http://support.microsoft.com/kb/307283 All it does is fail on the ConnectionString. Since I have no connection to a file that exists before I create it, how can I only connect to the SQL Express Server just to create a mdf/sdf database? I want to be able to just connect to the server and create the file, from there it probably will be easier to create the tables and such. Any suggestions? Ehsan Enaloo public static void CreateSqlDatabase(string filename) { string databaseName = System.IO.Path.GetFileNameWithoutExtension

Store an image in a SQL Server CE database

两盒软妹~` 提交于 2019-11-30 05:44:28
问题 Does any one know of an example on how to store an image in a SQL Server CE database? What data type should the column be? (I am guessing binary.) I use Linq-To-Datasets. Is it possible using that to put the image into the database and pull it out again later? Thanks for any advice. Here is how I did it: MemoryStream stream = new MemoryStream(); myBitmapImage.Save(stream, ImageFormat.Png); myInsertLinqToDataSetRow.IMAGE_COLUMN = stream.ToArray(); To load it back out again I did this: