sql-server-ce

Store an image in a SQL Server CE database

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 = ne...

How to Add a default value in SQL server compact?

Hi , I need to add default value column in SqlServer Compact....i am new to this SQL server compact so Plz anyone tell me the Solution of this.... Thanks In Advance ...

Why is the cache not invalidating in the code

Hi, I am just trying to work with Sql Cache dependency. Iam able to cache the data but I am not able to invalidate. I have enabled the service broker and also enabled the notification using :>aspnet_regsql -S -ed -d -E -et -t the code is as follows name = (string)HttpRuntime.Cache.Get("Details"); SqlConnection conn = new Sq...

Can I use SQL Server Compact Edition CE on Mono?

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? ...

Using Entity Framework for SQL Compact Edition 3.5 does not respect mode=exclusive property of connection string.

I am using SQL Server Compact 3.5 edition with Entity Framework and I want to have exclusive lock on the database as documented here http://msdn.microsoft.com/en-us/library/ms171817.aspx. However when you pass this in a connection string to Entity Framework it does not respect this at all. An example of the connection string as follow...

Which Database to use for CMS project in ASP.NET - SQLite or SQL server compact?

I am working on a CMS project using ASP.Net 3.5/Visual studio 2008.This is the first week of the project and I am working on the design of the system right now. Needless to say that this is my first project of this scale and I have no idea of what I am doing. The requirements of the project ask for a light but functional CMS, one which...

How to put large text data (~20mb) into sql cs 3.5 database?

...

Find out how much storage a row is taking up in the database

Is there a way to find out how much space (on disk) a row in my database takes up? I would love to see it for SQL Server CE, but failing that SQL Server 2008 works (I am storing about the same data in both). The reason I ask is that I have a Image column in my SQL Server CE db (it is a varbinary[max] in the SQL 2008 db) and I need to k...

Correct way to close database connection in event of exception.

Does the following code leave the connection open if there is an exception? I am using a Microsoft SQL compact edition database. try { SqlCeConnection conn = new SqlCeConnection(ConnectionString); conn.Open(); using (SqlCeCommand cmd = new SqlCeCommand("SELECT stuff FROM SomeTable", conn)) { // do some s...

Sql Server CE - Temporary disable auto increment on a specific collum

Hi guys. I have this little question, thats been on my head for while now. Here it goes: Is it possible to temporary disable the Auto_Increment on the collum ID. So that i can add a new row to the table and being able specify the ID value when inserting the row. And then in the end enable the Auto_Increment again,...

SQL Server Compact -- how to check for encrypted SDF file?

Is there a way to check if an SDF file is encrypted before calling SqlCeConnection.Open()? Or do you just try to open it without a password and catch a specific error -- maybe SSCE_M_INVALIDSRCPASSWORD? ...

When using SQL Compact on Windows Mobile, do you store the sdf file on a storage card?

Having had some Sql Compact db corruption issues in the past and gone through the article on these, I got the idea that storing the database sdf file on a storage card significantly increases the risk of data loss due to db corruption. Do you store the sdf file on a storage card? Have you had any issues caused by it? What should I pay ...

How can I rebuild / reorganize my indexes on Sql Compact 3.5 SP1 ?

I have a large (40 Mo) SDF database. Some queries are very long, but can become quick after some time. I would like to try to tidy up my indexes but I only find information for SQL Server and not for SQL CE. ...

How do I corrupt a SQL CE Database?

I want to be able to check for a corrupted database at startup, and then repair it programmatically. I can do that easily enough. My problem is that I want to test that things work the way I expect. Does anyone know of a way to purposefully corrupt a database so I can test my code? ...

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

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...

Can I create and connect to a SQL Server CE database if SQL Server 2005 isn't installed?

Is there any way to do this? Update: Sorry, I should have included more information. I am trying to create and connect to a SQL CE database using System.Data.SqlServerCe in C# running on a PC (i.e. not running on a Windows Mobile device). This code: string connstr = "Data Source=\"" + filename + "\";Persist Security Info=False;...

Breaking the SQL Compact 8K Limit?

I am creating a desktop application that stores rich text documents to a SQL Compact database. Documents are converted to a byte array and stored as a Binary column, and I am running into SQL Compact's 8K limit for Binary field length. Is there a simple way to get around the 8K limit? I can come up with lots of complicated ways to do it...

Storing rich text documents

This is a follow-up to another question I asked earlier today. I am creating a desktop app that stores rich text documents created in WPF (in a RichTextBox control). The app uses SQL Compact, and up until now, I had planned to store each document in a binary column in the database. I am rethinking that approach. Would it be better pra...

Connecting to a SQL Server Compact Edition (.sdf) from an MFC application

Hey ! I'm building an MFC app in Visual Studio 2008 which classifies textures and I need some sort of lightweight database to hold the characteristics (just some doubles and strings) which can be: -carried around with the app on different computers; -be able to perform queries on it from the app (searches , updates ,inserts ,etc); Cu...

Group by/count in LINQ against SQL Compact 3.5 SP2

Hello, I am using LINQ-To-Entities in C# and run queries against a SQL Compact Server 3.5 SP2. What I try to achieve is a simple group by with an additional where clause which includes a Count(). var baseIdent="expression"; var found=from o in ObservedElements where o.ObservedRoots.BaseIdent==baseIdent group o by o.ID into grouped ...