Click here to Skip to main content
15,891,184 members
Everything / Database Development / SQL Server / SQL Server CE

SQL Server CE

SQL-CE

Great Reads

by Tamer Oz
PocketPcAgent is an application that can be installed on Windows Mobile devices that are running Windows Mobile 5.0 or higher. The application listens to events such as SMS Received, Call Missed, E-Mail Received, Battery Strength Changed, and much more on the Pocket PC.
by Enrique Albert
Azure WebSite and W8 Store App using SQL-CE, Azure SQL, Mobile Services, SignalR, EF, WebAPI and integration to Bing Maps
by Bryan Sachdeva
This article describes how to create a wrapper class for the native Phone API, and then uses it to retrieve and store the call history.
by Md. Marufuzzaman
This tip shows you an easy way to split Microsoft SQL Server table row data.

Latest Articles

by Ebenezar John Paul
An Ideal Code Review Checklist that applies for most programming languages
by Emanuel Santos
In this article i will show how to create a basic application to detect and recognize faces using EmugCV.
by Neeraj Prasad Sharma
This article deals with performance difference with literal values
by NightWizzard
Handling for hex expressions and the trailing '}'

All Articles

Sort by Title

SQL Server CE 

25 Oct 2012 by Aadhar Joshi
Currently i'm using "Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64) Jun 17 2011 00:54:03 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) " version for sql server.I have added danish language registry to...
26 Oct 2012 by Sergey Alexandrovich Kryukov
Please see my comment to the question. As I say, your problem is not described, but you need to use Unicode, and Unicode SQL data types such as NCHAR, NVARCHAR2, NCLOB. Please...
6 Sep 2011 by akremb22
I got a project to complete some tasks on it, but when I try debug I have this error inDbProviderFactory Dbfactory = bProviderFactories.GetFactory(MasterConnectionProvider);With my MasterConnectionProvider is System.Data.SqlServerCe.EntityUnable to find the requested .Net Framework...
6 Sep 2011 by Wendelius
Have you referenced both system.data.sqlserverce.dll and System.Data.SqlServerCe.Entity.dll?
24 Mar 2009 by Shivprasad koirala
4 steps to use readymade DAL component (Data application blocks)
19 Sep 2009 by Paul Rony
A Programmer's Guide to Starting a Software Company and Building an Enterprise Application
23 Dec 2015 by Md. Marufuzzaman
A simple tip/trick to get rows on n’th maximum number from a table
18 Dec 2015 by Md. Marufuzzaman
A simple example of Microsoft SQL Server Pad String
19 Aug 2009 by Md. Marufuzzaman
This article will give you an idea about how to use CASE expression in T-SQL or as a formula of a particular column.
20 Apr 2008 by gan.gary
An article on a SQL IDE for different type of RDBMS databases
8 Jul 2013 by JP van Mackelenbergh
Abstracting the ORM Framework via Repository/Unit Of Work patterns
16 Apr 2012 by IviKAZAZI
Hello all,Im trying to access a sql compact database that is stored in a mobile device,from a windows application. I get a path error.What path should I use to acces it? I have stored the compact db in the device smart card.Thanks in advance!
16 Apr 2012 by OriginalGriff
Depends, I'm afraid. Assuming the device is cradled and connected to the PC, the first thing you need to do if try to access the file from Windows explorer. If you get there, then the address bar will give you a path which should work. If it doesn't then you could try this:...
9 Aug 2012 by SR.Rizwan
I am developing a small windows form with sqlCE. i made an installer to deploy it to another machine. I added the MyDB,sdf to the Application Folder. but when i run the application it gives me following error.Access to the database file is not allowed. [ File name = MyDB.sdf ]i checked...
9 Aug 2012 by Mehdi Gholam
"Program Files" in Windows is protected, so normal users cannot write there, your applications will probably work with an administrator user.Change the data folder path for your database to somewhere where all users have permission to write.
2 Mar 2003 by CT CHANG
Add, edit, and delete records/table/database in MS SQL Server CE v1.0/v2.0.
7 Jun 2013 by joshrduncan2012
Hi everyone!I have a simple issue that I can't see a resolution for right now. I'm hoping someone can pinpoint what I'm doing wrong.Main goal: Create new datarows for a datatable and add values for 3 columns to each datarow.DataTable waveform_file_dt = new DataTable();DataRow...
7 Jun 2013 by Richard C Bishop
Have a look here:Clicke me[^]This might be what you are looking for.
1 Nov 2013 by WM_m.f.m
how i deal with sql CE file in pc by using ado.net on vb.net?
9 Aug 2009 by Md. Marufuzzaman
This article will demonstrate how to split a string using Transact-SQL.
9 Aug 2009 by Md. Marufuzzaman
This article will demonstrate how to get a file name or a file extension as well using Transact-SQL.
28 Aug 2015 by Bert O Neill
AngularJS and Web API Active Directory Security (Authorisation)
11 Jun 2008 by Srinath Gopinath
How to handle an array parameter in a Stored Procedure [SQL Server].
4 Mar 2014 by Shivprasad koirala
18 Oct 2008 by Shivprasad koirala
Asp.Net Interview Question Part 3
27 Aug 2008 by Shivprasad koirala
ASP.NET interview questions: Part 1.
6 Feb 2005 by João Paulo Figueira
Exploring SQL CE 2.0 schema information with the ATL OLE DB Consumer Templates.
24 Mar 2008 by jangtimjang
Do you want to know what your DB programmers are doing?
23 Sep 2014 by SatyLepide
By analyzing log-in attempts on SQL server, admins can build the complete picture out of the sequence of events that led to compliance failure or unauthorized access.
27 Sep 2009 by acarpio1975
Given date ranged data, adjust existing ranges on entry of a new ranged data.
13 Apr 2015 by Sherif Kamel
When I add password to my SQL compact 3.5 database , the auto complete function for the textbox stops working (although I can connect normally to the database with the application.. Namely the connection is functioning properly).All the settings are the same as I did only add the password to...
13 Apr 2015 by ZurdoDev
As discussed in comments, after debugging the code you were able to find the issue and have it working now.
12 Mar 2012 by MartynL2011
Hey thereI was wondering if anyone could provide me with information about SQL databases and C# Applications. Basically I'm working on a project in which I would like to be able to Create, Import, Export and Delete SQL Databases using a C# Application automatically. By this I mean that...
13 Mar 2012 by ProEnggSoft
You can take a look at this articleGeneral purpose class to fill DataTable(s) from DataBase and to save DataTable(s) to DataBase using reflection[^]It may be helpful to you.
3 Jul 2011 by Alexander Galkin
Provides a sample code for a simple test bench application and compares the performance of two most common embedded databases for .NET: Microsoft SQL CE 4.0 and SQLite.
22 Oct 2015 by Steve Naidamast
Best Embedded RDBMS Databases for .NET developers
2 Dec 2009 by Indivara
Does anyone know if a bootstrapper package exists for SQL Server Compact Edition v3.5 Service Pack 1?(the pre-SP1 package resides in Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\SQL Server Compact Edition\)I've looked everywhere (SDKs, SQL runtime, etc) and none seems...
1 Dec 2009 by ErikEJ
I have the 3.5 SP1 bootstrapper installed, assume it came with VS 2008 SP1.
30 Jan 2013 by joshrduncan2012
How can I add the content of this clipboard to a datarow to be placed in the original datatable? The dataadapter and datatable declarations are not global.if (this.dataGridView1.GetCellCount(DataGridViewElementStates.Selected) > 0){ try { DataGridViewRow dgvr = new...
30 Jan 2013 by Abhinav S
This could be possible to do in a number of interesting ways.The simplest would be to handle the the keydown event on the grid (capture Ctrl + V).Here are some articles that might help you...
23 Oct 2012 by joshrduncan2012
Hi guys,I am running into issues with checking for empty datareaders. I am using Visual Studio 2012 with SQL Server Compact 4.0. The HasRows property is not supported in Compact, so I can't use that.This is what I have right now.if ( ( (ac_key_number_dr.Read()) &&...
23 Oct 2012 by OriginalGriff
Your logic has a small flaw:Read returns true if it has data, so a.Read() && b.Read()is true if and only if a and b both have data.Conversely,(a.Read() && b.Read()) == falseif true if either of a or b does not contain data, or if both do notIf you want your statement executed only...
23 Oct 2012 by Daxa Rughani
Assuming Read() returns TRUE if Read() succeeds then you want change your logic as below.If any Read() succeeds loadDefault() will not get called.if ( ( (ac_key_number_dr.Read()) || (cc_key_number_dr.Read()) || (key_number_dr.Read()) || (hybrid_key_number_dr.Read()) ||...
5 Feb 2014 by Ripoll_Ionn
I am developing a C# application with a .sdf database, I have SELECTs, UPDATEs and INSERTs, and all they work while I'm compiling the application.I mean, I add, delete and modify records, and it works okay i can play with all my information while the app is running. BUT if I close the app...
17 Feb 2014 by Ripoll_Ionn
I finally understand what happened with this topic.When I run my application, my database was selected from my root, but when It was compiled, my database was moved to \bin\bd.sdfSo, all my updates and deletes were done BUT ON MY bin\database.sdf.I closed the applicatión and after I...
13 Mar 2013 by joshrduncan2012
Hi everyone!Is it possible to use the SaveFileDialog in Visual Studio 2012 to allow the user to save a .sdf file anywhere they want to? That's what I mean by "exporting" the .sdf file out of the project location (or installed directory) when the program is installed on an end-user's...
13 Mar 2013 by Mike Meinz
You can use SaveFileDialog for any type of file.Some unsolicited adviceI would be cautious about allowing your end-user to save your database file anywhere they want. After a while, you may end up with copies in multiple places. An option would be to automatically save the copy to a...
10 Jul 2014 by Ray Andefi
research to create software and hardware
28 Jan 2013 by joshrduncan2012
Hi everyone!I am trying to make a datagridview with the cells being in the combobox format and being able to be typed into. I've not been able to find a way to type into them in the combobox format. I've found a way to add comboboxes next to the textboxes but have the comboboxes only be...
7 Mar 2013 by joshrduncan2012
Hi everyone,I am in the process of testing update statements to SQL using C#. I am finding that the update statements pass, but the db doesn't get updated. Am I missing a commit (or something similar) ?Here is what I have so far:try{ SqlCeCommand updateKeyCommand =...
7 Mar 2013 by sorawit amorn
(1) Make sure that you update an existing table/column/row(2) Make sure that the command that you use does not contain the character (') because sql will not be able to recognize the syntax as a command.For example : "UPDATE testtable SET Test_Col_1 = 'someString' WHERE Test_Col_1 =...
8 Mar 2013 by joshrduncan2012
Hi everyone!I am having an issue with dataadapter update methods. Here is what I have so far:List tempColumnList = new List(); List tempColumnFinalList = new List(); SqlCeCommand getTableListingCommand = new...
20 May 2013 by joshrduncan2012
Hi everyone!I have a question regarding LinQ to XML and iterating through a list.This is my code so far:new XElement("caption", data.ToList().Select(x => x))What this is doing is printing an XElement statement with everything in the list "data". What my intent is is to have one...
20 May 2013 by MKNayak
You need to iterate through data and yield an XElement for each item.var result = new XElement("captions", data.Select(x => new XElement("caption", x)));This will generate the result like, a b c In your scenarion it assumes, there is a single node with a value of...
15 Feb 2013 by joshrduncan2012
Hi everyone!I am running into an issue that I need some advice on. I am using parametrized queries to get information from chosen items in comboboxes to place in the queries for further down.The idea that I have right now is:Combobox 1 - get table nameCombobox 2 - get column...
15 Feb 2013 by OriginalGriff
You can't pass the name of the column as a parameter - you would have to concatenate strings to create the command (and be very careful to protect yourself from SQL injection attacks):SqlCeCommand accessoriesCommand = new SqlCeCommand("SELECT DISTINCT " + subcategory + " FROM accessories", conn);
15 Feb 2013 by PIEBALDconsult
Might something like the following be useful?SELECT 'SELECT DISTINCT '+[2]+' FROM '+[1] FROM __sysobjects WHERE [1]=@TableName AND [2]=@ColumnNameIf the table and column exists you should get a result which you can then execute.
20 Feb 2017 by joshrduncan2012
Hi everyone!I am working on an element of a project that has to do with FTP uploading files. This is the code that I have to upload all types of files.#region FTP Upload// Get the object used to communicate with the server.FtpWebRequest request =...
19 Jul 2013 by Ron Beyer
You should use a BinaryReader instead of a stream reader. You are converting all the bytes to UTF-8 and probably screwing up anything that is binary since it is probably detecting a different encoding. With BinaryReader you don't need to use the Encoding.UTF8.GetBytes, just use the methods on...
2 Aug 2010 by ryan17
Hi i made a c# prodject that uses System.Data.SqlServerCe to create a sdf which I then copy to a ce5.0 device.This works fine in xp but when I run the same project in windows 7 i get weard errors. PLEEEEESE HELP!!!!!!!!!!!!!!!!!!1st : I had to change the name of one of the tables as the...
2 Aug 2010 by E.F. Nijboer
For the first problem try this:select * from [ryanstable1]For the second problem look into quoted identifiers:http://www.sommarskog.se/dynamic_sql.html#QUOTED_IDENTIFIER[^]I guess the default options aren't the same on your windows 7 machine and therefore give errors that weren't...
4 Aug 2010 by ryan17
The first problem is the table is almost corrupt if it has a digit in it. On the mobile devices sql mangager you can see the table name but cant edit or see the columns. Im not to worried about that though as I just changed the table name to something without a digit,I included it as I thought...
13 Feb 2013 by joshrduncan2012
Hi everyone!Part of my project is to give the user an option to clone/duplicate a row to the bottom "newrow" incase they want to make 1 or 2 cell edits. This is what I have so far in accomplishing this mission.try { highlightBottomRow(); ...
15 Feb 2013 by Michiel du Toit
DataRow's have an ItemArray property that represent all the field values as an object[]. DataRow existingrow = //Your existing row;var newrow = tbl.NewRow();newrow.ItemArray = existingrow.ItemArray;And then just increment the ID if you're DataTable's schema isn't configured to do...
19 Feb 2013 by joshrduncan2012
Hi everyone!I need some advice on how to keep a row highlighted (backcolor) after a column header is clicked to resort.This is what I have right now:foreach (DataGridViewRow dgvr in dataGridView1.Rows) { if...
19 Feb 2013 by Sergey Alexandrovich Kryukov
You can do it by changing the default style of the row: http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.rowsdefaultcellstyle.aspx[^].For more information on cell styles and presentation, please see: http://msdn.microsoft.com/en-us/library/1yef90x0.aspx[^].—SA
21 Feb 2014 by Hunain Hafeez
I am trying to calculate YTD (Year to date) salary amountYTD: "YTD" means Year-To-Date. It is the period starting January 1 of the current year until the last day of the pay cycle. Current means what you made that pay period.e.g. Your actual pay for January = 15000, for Feb=20000, for...
21 Feb 2014 by W Balboos, GHB
SELECT SUM(...) FROM YourTable WHERE YEAR(paydate) = YEAR(getdate())This will give you the sum of all values for the current year.In your code, it seems like you're calculating the amount paid based on hours and rates. In your text description, it seems that you're summing the amounts...
19 Jul 2012 by Gary Heath
I want to put my SQL commands into a Module, so that whenever I have a command to execute, I can set up a couple of variables and call the Module, therefore avoiding repeat code and streamlining my logic. Something like :mySqlExpression = "DELETE FROM Leagues Where LeagueName = '" & myLeague...
20 Jul 2012 by tiggerc
dim sqlcmd as new sqlclient.sqlcommand( strCommand, strConnection )dim param as sqlclient.sqlparameterparam = new sqlClient.sqlparameter( "@Param", int )param.value = valuesqlcmd.parameters.add( param )Look at stored procedures and SQL parameters
20 Jul 2012 by Gregory Gadow
It is kind of a bad idea to put your main SQL code in a module: if your database requirements change you will need to recompile and redistribute your app, which can become a major headache. You are better off using views and stored procedures on the SQL server itself, especially for core...
25 Aug 2011 by choudhary.sumit
when i deploy a windows application i attach a .bak file with application files... then i install app in other computer which has no server installed but as a prerequisites i install sql compact edition on that computer......so the problem is that the code written for database restore fails...
25 Aug 2011 by OriginalGriff
If your aim is to use the .BAK file to build a new, known copy of the database, why not use either:1) An SqlCE database file instead? These are self contained, and can be copied / moved like all other files as part of an installation process.2) An SQL Script file which contains the data as...
29 Aug 2013 by DominicZA
Hi there,I am trying to do a join in SQL. I do the join but it always returns the first object instead of a collection of objects. Here is my code: IEnumerable data = (from figure in context.Figures join rarity in...
3 Sep 2013 by Ganesh KP
Hi DominicZA,Hope this helps you http://stackoverflow.com/questions/2723985/linq-join-2-listts[^]If u need any more help, just ask here.ThanksGanesh
16 Dec 2011 by Balu199
Hi all,I want to insert a string with single quotations like this 'StringName' in SqlCE.any one have idea? please share with me.Thanks,Balu.
16 Dec 2011 by Wendelius
Yes it is. Sounds like you may concatenate strings to you SQL statement. Don't do that. Instead use SqlParameter[^]. With parameters you won't have any problems with quotation marks
16 Dec 2011 by Amir Mahfoozi
As I understood your question you want to have single quote in your string literals so use it double to distinguish it from the SQL command single quote , for example :insert into names(name) values ('John') will insert John , but :insert into names(name) values ('''John''') will...
21 Jul 2011 by Gregory Gadow
I want to look at using SQL Compact Edition as the source for a text based game (yeah, yeah, very nostalgic) but I cannot get a database created. In Visual Studio 2008, I have tried this:1. Right click Data Connections in the Server Explorer and select "Add Connection" from the menu.2....
21 Jul 2011 by OriginalGriff
The sequence is correct - when I try I get the "Create New SQL Server Compact Database" dialog after pressing the "Create" button.However, I also have SQL Server 2008 R2 installed on my machine, so my configuration may not be the same as yours. I do vaugely remember having problems creating...
10 Jan 2012 by Furqan Sehgal
Hello,I want to change Mode of connectivity in Typed Dataset. But I can not change the connection string. I want it from Read / Write (default mode) to Exclusive to be used on Shared network.In this topic, you will learn how to set the file mode when you open a Microsoft SQL Server 2005...
10 Jan 2012 by fjdiewornncalwe
Since you obviously got your information from here(MSDN)[^], try reading to the bottom of the page to the code example. The answer you are looking for is right there for you. I'm not going to copy-paste the answer to your homework here, doing the actual "work" is for you.
29 Jan 2013 by joshrduncan2012
Hi everyone!I am having an issue with checking for whether or not cells/columns/rows are selected in a datagridview.Here is my code:bool isRowSelected = dataGridView1.Rows[e.RowIndex - 1].Selected; bool isColumnSelected =...
29 Jan 2013 by Sergey Alexandrovich Kryukov
The first bug I can see is: e.RowIndex can be 0, in this case, e.RowIndex − 1 will be −1, which is of course out of range, indexing with this index value throws ArgumentOutOfRangeException.Fix this trivial bug first, and then see if you have other problems. :-)—SA
20 Jul 2012 by Gary Heath
As per the Subject line, a very quick question ...I have code similar to this in various places in my program :If mySqlConn.State = ConnectionState.Closed Then mySqlConn.Open() Using mySqlRdr As SqlCeDataReader = mySqlCmd.ExecuteReader() ...
20 Jul 2012 by OriginalGriff
In the code above, you close both your Connection (explicitly, via teh Close method) and the Readewr (implitly, via the using block which does a Close and Dispose).What you should be doing is closing both and (preferably) Disposing both, since they are scarce resources and should not be...
18 Jun 2012 by Elk Cloner
Conflice Detection in Peer - to - Peer ReplicationService Broker Priorities and DiagnosticsADO.NET Data Services Anyone know about this features of SQL SERVER 2008 Please share with me.
18 Jun 2012 by Prasad_Kulkarni
Yes; google[^]conflict detection in peer-to-peer replication in sql 2008[^]Service Broker Priorities and Diagnostics in sql 2008[^]ADO.NET Data Services in sql server 2008[^]Just check out first 5 links of each search. Always TRY google first then post here if you get stuck'd.
9 Nov 2013 by Damijan Vodopivec
Sample Code First project with SQL CE 4.0 database
24 Feb 2017 by Ebenezar John Paul
An Ideal Code Review Checklist that applies for most programming languages
5 Jan 2013 by Vimalsoft(Pty) Ltd
Coding an N-Tier application in C# without using Wizards.
23 Mar 2011 by pwtc222
Hello,i'm developing a windows application where it will convert textfile to sql compact database.this converted data from textfile will be stored in table 1.table 1 have 2 colums,itemcode and qty:itemcode qty111111 3111112 2111113 4and i have table 2 with 4 colums...
24 Mar 2011 by Perry Bruins
Not really understand your question. It looks like you can fill table 1 with info from table 2 using a SQL group by construct like:select itemcode, sum(quantity) from table2 group by itemcodewhat is exaclty your question?
25 Mar 2011 by JOAT-MON
If I understand your question, you will need a query that utilizes sub-queries and inner join to generate the appropriate resulting table. I think it would be something similar to this:SELECT tbl1.itemcode, tbl1.T1Quantity, tbl2.T2Quantity, (tbl1.T1Quantity -...
26 Mar 2013 by joshrduncan2012
Hi everyone!I am having trouble converting the FileVersionInfo.GetVersionInfo number to a double. I need to compare it to a number to alert the user that the 3rd party program is out of date.Here is what I have so far:FileVersionInfo psVersionInfo =...