Click here to Skip to main content
15,884,099 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 Score

SQL Server CE 

7 Sep 2009 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.
24 Jun 2013 by Enrique Albert
Azure WebSite and W8 Store App using SQL-CE, Azure SQL, Mobile Services, SignalR, EF, WebAPI and integration to Bing Maps
19 Dec 2007 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.
24 Mar 2013 by Maciej Los
For developers who want to own - without the need to work more manufacturing team, produce a software dedicated to one particular platform, there is a family of Visual Studio Express. The families of these products are available in the following versions:- Visual Studio 2010 Express for...
18 Dec 2015 by Md. Marufuzzaman
This tip shows you an easy way to split Microsoft SQL Server table row data.
17 Aug 2012 by ManojKumar19
Update row column with another row column in same table SQL only if it is null.
24 Mar 2013 by Kenneth Haugland
Your question is answered in the agreement which you proberbly as most people just clicked through. Anyway a quick search reveiled that there seems to be no restrictions on...
24 Mar 2013 by André Kraak
Quote:Visual Studio Express 2012 ProductsA number of free development tools are also available, including Visual Studio Express 2012 for Windows 8, Visual Studio Express 2012 for Web, Visual Studio Express 2012 for Windows Desktop, and Visual Studio Express 2012 for Windows Phone 8. These...
16 Apr 2009 by MiamiCoder
How to create a real-world BlackBerry application.
8 Jun 2010 by DaveAuld
Use a standard where query to filter between the two dates, and also AND in a datepart(hh, colname) filter for the time range.
7 Aug 2012 by ManojKumar19
This tip demonstrates how table data can be shared in two stored procedures.
20 Sep 2012 by Sreedhar Puligundla
Simple steps to create SQL joins by using SQL Server 2008 Management Studio
29 Jul 2013 by Maciej Los
Try this:DECLARE @INSTOCK TABLE (WareHouse INT, Code VARCHAR(30), Qty INT)INSERT INTO @INSTOCK (WareHouse, Code, Qty)SELECT 1, '0001', 5UNION ALL SELECT 1, '5555', 4UNION ALL SELECT 2, '0001', 6UNION ALL SELECT 3, '0001', 2UNION ALL SELECT 3, '4444', 2 DECLARE @OUTSTOCK...
17 Aug 2011 by bmckuhen
12 Mar 2012 by OriginalGriff
This isn't the exact code, but it is a starting point. All the bits you need are there.using (SqlConnection con = new SqlConnection(strConnect)) { con.Open(); using (SqlCommand cmd = new SqlCommand("SELECT description FROM myTable WHERE ID=@ID", con)) { ...
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 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.
22 Jan 2013 by ujju.1
I have a table, say tbl_test with data in following format.tbl_test_____________________Action_Id_____________________123/221/4556/32_____________________5643/990_____________________676_____________________I want the output to split the action id by '/' and show the...
22 Jan 2013 by Tharaka MTR
Check my article below, you just have to modify the delimiter string, if you have any question please let me know.Generating and splitting a delimited string column[^]
7 Mar 2013 by Richard MacCutchan
The above code would not even compile (your class types are wrong), and you are missing the actual connection string; your code should be something like:SqlCeConnection con = new SqlCeConnection(Properties.Settings.Default.DBConnection);con.Open();
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...
29 Jul 2013 by Mukesh Ghosh
Try this as wellCREATE TABLE #INStock (WareHouse NVARCHAR(50), ItemCode NVARCHAR(50),Qty INT)CREATE TABLE #OUTStock ( WareHouse NVARCHAR(50),ItemCode NVARCHAR(50),Qty INT)INSERT INTO #INSTOCK (WAREHOUSE,ITEMCODE,QTY)VALUES ('1','0001',5)INSERT INTO #INSTOCK...
20 Feb 2014 by OriginalGriff
RETURN only allows you to return an integer value: you cannot return a string.You need to use SELECT, or create an OUTPUT parameter.
12 Dec 2015 by Rajdeep Debnath
Please try the below way....Format the sql query with stringbuilder and add where clauses as required...var sqlcmd = new SqlCommand(); StringBuilder sb = new StringBuilder(); sb.Append("Select * from Cases WHERE "); if (S1.Text != string.Empty) ...
1 Dec 2009 by ErikEJ
I have the 3.5 SP1 bootstrapper installed, assume it came with VS 2008 SP1.
17 Jan 2010 by Sandeep Mewara
Your current query:SELECT StockName, StockPrice, StockDateFROM StockTableWHERE (StockDate = (SELECT MAX(StockDate)FROM StockTable))New query:SELECT SUM(StockPrice) as StockPriceSumFROM StockTableWHERE (StockDate = (SELECT MAX(StockDate)FROM StockTable)) Result of it...
6 May 2010 by AspDotNetDev
Since you are running your own server when you connect to SQL Server CE, you need to have read/write permission to the database file. In your remote call, it looks like you are trying to connect to a SQL Server database rather than a SQL Server CE database. When you connect to a SQL Server...
11 May 2010 by suneer0000
Hi friend don't worry am giving u link this will be helpful for uhttp://msdn.microsoft.com/en-us/library/bb226707%28SQL.90%29.aspx[^]
8 Jun 2010 by Speed.Of.Light
Hi everyone,I'm doing a small ADO.NET/C# application using SQL Server Compact Edition.There's a table with a DateTime field, and I want a query that filters data depending on time and date.For example: I want all the rows with the time between 1:00 am and 2:00 am AND the date between...
10 Jun 2010 by TheyCallMeMrJames
Try to create another application (we'll call this APP2) with no DB and create your deployment package the same way you are doing for the one you're working on now (which we'll call APP1).Deploy both apps to the device in question.Start APP2, time it and close it. Start it again and see...
30 Aug 2010 by Lantei
If you want to create a database from VBA then you would need to do that in a stored procedure and implement it in VBA through ADO.create procedure _procedureNameasbegincreate table _newTable( [ ])end
9 Sep 2010 by Uros Calakovic
To answer the question, Dennis Wallentin has provided VBA code to create a Sql Server CE database here[^]. Copy of the code for future reference:Option Explicit'Reference to Microsoft ActiveX Data Objects x.x Library.'Reference to Microsoft ADO Ext.x.x for DDL and SecuritySub...
12 Jan 2011 by Valery Possoz
Hi,Try InnoSetup... It's free easy and very well documented.http://www.jrsoftware.org/isinfo.php[^]There are plenty of resources available:.NET Framework 1.1/2.0/3.5 Installer for InnoSetup[^]Writing A Good Setup For Your Applications[^]Valery.
4 Mar 2011 by Furqan Sehgal
Hi, I wrote a query to get data between two dates (SSCE database) in the following way.Where DTE between @D1 and @D2it does not work. Then I tried Where DTE between @#D1# and @#D2#But it also does not show the data between I gave the dates.D1 and D2 get dates from two...
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...
27 Jul 2011 by Shameel
I believe you cannot use column alias in the WHERE clause. Replace it with the actual column name.WHERE PlusAreaOperation.IdPlusWorkSiteArea = @PlusAreaOperationIdPlusWorkSite
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
25 Dec 2011 by Dalek Dave
Better off with server, it has more functionality.The Compact Edition still works but with less width of control.It ultimately depends on your needs and preferences, but SQL Server is a standard box of tricks that people are familiar with, so legacy wise it is better.
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.
28 Jan 2012 by Amir Mahfoozi
To view objects which are depend on a table :EXEC sp_MSdependencies N'TableName', null, 1315327To view objects on which a table depend on :EXEC sp_MSdependencies N'TableName', null, 1053183Extracted from here...
30 Jan 2012 by mhd.rad
Hello my friends.I'm programming a store management for POS device with "Windows CE 6.0". These device are so low. The ram in these device is the hard :-(.Now, I have 15000 record and wana select records where the "CategoryCode column" value is '445500' (Count of these record is 50).I...
13 Jul 2017 by IviKAZAZI
Hello everyone,Im trying to fill some textboxes with values from a database table.when i write a name in a textbox,i use it as a parameter for the query,the query result should show the values in different textboxes,for example the surname in one textbox,the id in another etc.Is there any...
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:...
15 May 2012 by Prasad_Kulkarni
Please refer this links:Here is some short few steps to write/ retrive an image to a SQL CE database on Windows Phone:Writing an Image to SQL CE / Linq to SQL[^]How to retrieve image stored in SqlCe DB and display for Windows phone [^]How to retrieve image stored in SqlCe DB and...
4 Jun 2012 by Prasad_Kulkarni
Mapping is logical connection between two entities.In SQL, you can Map Database[^],Data types[^],Tables to Objects[^]SQL types to JAVA types[^]Also refer this thread for more:Requirements for using SQL mapping[^]Here are more Details in pdf[^]
21 Jul 2012 by OriginalGriff
You can Add the parameters before the loop, using Parameters.Add instead of AddWithValue, and the set the value inside the loop.But more significantly, INSERT statements do not use a Reader...so you can throw that line away!
31 Jul 2012 by Kenneth Haugland
The only thing we can do for you would be to reffer you to the sample from Microsoft were you got the code from:HTTP://msdn.microsoft.com/en-us/library/cc488004(v=vs.90).aspx[^]I you cant resolve it with that information you should look for tips in the WCF...
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...
27 Aug 2012 by CPallini
Here[^] a way to do that.
27 Aug 2012 by Maciej Los
CPallini solution is very good. It shows a way to achieve the problem using database definition.I think, you can do it programmatically. Each time, when user will add every single record to the database, just check the recordcount. Simple?
1 Oct 2012 by OriginalGriff
You haven't set any of the parameters you specified in the command string: SqlCeCommand code_comm_two = new SqlCeCommand("SELECT transmission_code FROM vehicles WHERE make = @make AND model_name = @model AND model_year = @model_year AND engine_type = @engine_type", conn);You have...
13 Feb 2013 by Maciej Los
Try below query:DECLARE @cols NVARCHAR(200)--rating starSET @cols = '[1],[2],[3],[4],[5]'SELECT [CompanyID], @colsFROM (SELECT * FROM Company) AS DTPIVOT (COUNT([CompanyId]) FOR [RatingStar] IN (@cols))Result:CompanyID 1 2 3 4 55636 0 0 0 0 ...
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...
3 Mar 2013 by Sandeep Mewara
Did you try and see what you get if you do:ORDER BY columnB, columnA
7 Mar 2013 by Mike Meinz
You must put the ConnectionString into the SQLCEConnection object before you Open the connection.See SQLCEConnection Constructor[^] for an example.Example of how to retrieve ConnectionString by NameExample: Retrieving a Connection String by Name[^]Other documentation about...
26 Mar 2013 by bbirajdar
Join the Microsoft BizSpark program here[^]Advantages:Get the following benefits FREE of charge for up to three years:Software, cloud computing, and support to help you grow your business.Access to network partners, including investors, mentors and startups in your area and around...
24 Apr 2013 by OriginalGriff
It will work fine. I use SqlCE on this PC and I also have an SQL Server 2008R2 instance running on it without problems. SqlCE does not use a server - it's a stand-alone single user solution so it doesn't have to. The client need never even know...
28 Apr 2013 by Prasad Khandekar
Hello,DatabaseClass in WebMatrix has a method named GetLastInsertId which Returns the identity column of the most recently inserted row. Use it to retrieve the AuditNum value and then issue the second insert. For more help see this link[^]Regards,
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...
28 May 2013 by Matt T Heffron
It looks like your could do what you want with the .Distinct() method of Linq: var linqCollection = (from item in linqDT.AsEnumerable() select item["table_name"]).Distinct();
7 Jun 2013 by Richard C Bishop
Have a look here:Clicke me[^]This might be what you are looking for.
24 Jun 2013 by OriginalGriff
Change it slightly:sqlClkIn.Parameters.AddWithValue("@tcEID", strEmployee);sqlClkIn.Parameters.AddWithValue("@tcJID", strJob);sqlClkIn.Parameters.AddWithValue("@tcClockIn", theDate);SQL and the framework will sort out the correct datatype.[edit]That'll teach me to copy 'n' paste from...
12 Jul 2013 by Behno0o0oD
By using SqlCeEngine class and one of the methods, it is possible to create database in your hard drive! :)using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.SqlServerCe;using System.Data.SqlClient;using System.Data.Sql;namespace...
3 Aug 2013 by Amar Kapadia
Quick Solution: Field Names in tables must not have spaces in them.Hello EveryoneI think I might know what is happening here. Indeed, perhaps all this stemmed from the Northwind40.sdf SQL Server Compact Edition 4.0 database file I was using. Again, I'm not sure how I got it but must be...
11 Aug 2013 by OriginalGriff
You need to get into the habit of naming your columns when you do an INSERT operation: because you have an IDENTITY value as the first column, you need to explicitly skip it and start inserting from the second:INSERT INTO UserProfile ([User], [Group], Email, TipsByEmail, Phone, TipsBySMS) ...
23 Sep 2013 by Matt T Heffron
Try this console app that will show you all of the headers returned by the server.Url to the SDF file as the command line argument.using System;using System.Net;namespace HttpHeaders{ class Program { static void Main(string[] args) { if (args.Length
29 Sep 2013 by Raja Sekhar S
If you want to use SubQuery u can useSELECT TagNumber,ParkingType,DistanceToNextTagFROM MyCarWHERE Id in (Select Distinct Id From MyCar Where TagNumber BETWEEN 6554 AND 65635)If you want to use a join...SELECT mcid.TagNumber,mcid.ParkingType,mcid.DistanceToNextTagFROM MyCar...
29 Oct 2013 by Dipesh Wadhwa
Modify your SQL command as followsmyCommand = "Select SiteCodeAndDate from Shifts where Date > getDate()";getDate() is an Sql Funtion that gets current syatem date and time/
3 Dec 2013 by GC Kachhadia
I Have Perfect Solution For SQLCE Datareader....Now You Can Use Like This.................Dim cmd As SqlCeCommand Dim dr As SqlCeDataReader Dim i As Int32 = 0 cmd = New SqlCeCommand(str, con) dr = cmd.ExecuteResultSet(ResultSetOptions.Scrollable) ...
3 Jan 2014 by RKparmar
HI I want output like this I have one column from the table Date Time 2013-12-17 14:41:00.0002013-12-17 16:00:00.0002013-12-17 16:29:00.0002013-12-17 16:32:00.0002013-12-17 17:54:00.0002013-12-17 17:55:00.000in 2nd column remove first record Output should be like this...
15 Jan 2014 by Christian Graus
Use IsNull or Coalesce to set defaults for when a value is null. Use Case.. when... else... end where you want to set defaults based on existing non null values.Ask a question with sample code in order to be given back working code.
19 Jan 2014 by Sergey Vaselenko
Use DATEDIFF function like this:SELECT CAST(41657 AS datetime)SELECT DATEDIFF(DAY, 0, CAST(41657 AS datetime))
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...
8 Mar 2014 by davton
Make sure the AMD64 and x86 folders (and files and sub folders)are in your output folder for debugging. Either include them in the project with copy local, or manually copy and paste them into your bin/debug file.
20 Mar 2014 by Member 10621420
You need to add the following:SqlCeConnection conn = new SqlCeConnection("Data Source=nonExistingSource.sdf;");try{ conn.Open();}catch (SqlCeException e){ // Use SqlCeException properties if you need specific // application logic depending on the error condition ...
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.
12 Dec 2015 by BillWoodruff
I suggest you create a data structure to hold the instances of TextBoxes you use:List ParameterTextBoxes = new List;Somewhere in your code add the TextBox instances to this list.Then, when you want to only add SQL Parameters when the TextBoxes have active content...
12 Dec 2015 by Rajdeep Debnath
I have added a bool switch to take care of that....compacted the codestatic void Main() { var S1 = new System.Web.UI.WebControls.TextBox(); var S2 = new System.Web.UI.WebControls.TextBox(); var S3 = new...