Click here to Skip to main content
15,891,136 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 Updated

SQL Server CE 

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...
25 Apr 2017 by Uros Calakovic
Accessing a SQL Server CE database from VBA is not a problem:Set objConn = New ADODB.ConnectionobjConn.ConnectionString = _ "PROVIDER=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=D:\testDB.sdf"objConn.OpenThere is an example of creating a new SQL CE database using C#...
19 Apr 2017 by QuentinEllison
I want output as Printers,Printers,null (select at least first two fields) with this very existing query and any kind of join select a.acName,a.discription,s.quentity from #Accounts a inner join #stock s on a.id = s.acId where addDate between '2001-11-01' and '2001-11-11' and a.id = 1 What...
19 Apr 2017 by NightWizzard
Thanks CHill60 - I've overseen that addDate is also from second table. To return the 'null' for quantity let's complete it at last: select a.acName,a.discription,IsNULL(CAST(s.quentity AS nvarchar(10)), 'null') from #Accounts a left join #stock s on a.id = s.acId where ((s.addDate between...
19 Apr 2017 by CHill60
You need to use LEFT OUTER JOIN and cater for scenarios where nothing is being returned by the join. Like thisselect * from #Accounts A left outer join #stock S on A.id=S.acId where A.id = 1 AND ((addDate between '2001-11-01' and '2001-11-11') OR addDate IS NULL)
18 Apr 2017 by NightWizzard
Use this: select TOP 1 a.acName,a.discription,IsNULL(CAST(s.quentity AS nvarchar(10)), 'null') from #Accounts a left join #stock s on a.id = s.acId where addDate between '2001-11-01' and '2001-11-11' and a.id = 1
18 Apr 2017 by NightWizzard
INNER JOIN restricts the result to those records that have matches on both sides. To always return all records from first table (and matching records or NULL values from second table) use LEFT JOIN.
21 Mar 2017 by Kashif Alvi
Hi All,I have an application which uses Sql server compact 4.0 as a database, and written in Visual basic. Now for further development I want to add reporting in it. I have install Crystal report on visual studio 2010 SP1 but found that there is no way to connect SQL server compact edition...
24 Feb 2017 by Ebenezar John Paul
An Ideal Code Review Checklist that applies for most programming languages
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 =...
7 Sep 2016 by Emanuel Santos
In this article i will show how to create a basic application to detect and recognize faces using EmugCV.
26 Aug 2016 by Neeraj Prasad Sharma
This article deals with performance difference with literal values
11 Apr 2016 by Amar Kapadia
Hello:Although I am very new to using embedded Reports (.rdlc) in WinForm applications (in C#), I think I understand the basic concepts. I've been experimenting and practicing to get better at this. Yet, I am having one strange problem. I've Google searched all this morning for a solution...
9 Apr 2016 by NightWizzard
Handling for hex expressions and the trailing '}'
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
18 Dec 2015 by Md. Marufuzzaman
This tip shows you an easy way to split Microsoft SQL Server table row data.
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...
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
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) ...
12 Dec 2015 by Sherif Kamel
I'm using an intensive search feature with around 16 text boxes to search in 16 columns of the databasethe problem is that when I try to search through more than 1 text box, it usually shows all the rows in the databasewhat I want to achieve :is to simply ignore all the empty fields \...
9 Dec 2015 by Roger C Moore
This tip is a guide for using the Codeplex project Effort for testing Entity Framework applications without requiring the unit tests to actually hit the SQL Server database.
22 Oct 2015 by Steve Naidamast
Best Embedded RDBMS Databases for .NET developers
2 Oct 2015 by Sherif Kamel
I want a simple and organized way to migrate my data from multiple excel sheets to one single SQL compact 3.5 database fileWhat I did to work this thing out was trying to load the excel sheet into a datagridview and then save it to the sql CE database, but it always gives error and duplicates...
1 Oct 2015 by Maciej Los
I'd suggest to use SqlCeBulkCopy class[^] (from codeplex), which provides several options to copy data between databases in a safe way. How to use it?1) download and install this nuget packet[^],2) create new project,3) create new OleDbConnection[^] to load data from Excel into...
28 Aug 2015 by Bert O Neill
AngularJS and Web API Active Directory Security (Authorisation)
5 Jul 2015 by aashish_9601
Hi..I am trying to learn windows phone development.After going through tutorials on the internet , i am making an DataBound App.so far, i have created an database and an DataContext of the db. and using it to populate the LongListSelector as follows Protected Overrides Sub...
11 Jun 2015 by Mohammed-cd7
please i need to convert a database .mdf into sql compact edition v4 database (.sdf).i have the solution of codeproject( SQL Server to SQL Server Compact Edition Database Copy Utility[^] )but i did not understand how to use it. thank you
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.
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...
10 Apr 2015 by Richard MacCutchan
1. How to add an equationThis is just code, you decide what calculation you need to use and add it to your program. Where? Only you will know the answer to that. Do you actually need a calculation or would a GUID do the job?2. How to fetch Hardware IDLook at these links from Google:...
8 Apr 2015 by Sherif Kamel
I'm working on a simple windows application using WinForms [C#] and SQL Compact database. I think of providing a manual serial activation method [Online] through :- Name- Hardware ID (PC id or whatever it's called)So the mechanism goes as follow :- I (personally or any other official)...
16 Feb 2015 by DrABELL
Her Most Significant Bit™ NY-2013, All-in-One/Win8 (AIC-2013 FINALIST app)
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.
11 Aug 2014 by Afzaal Ahmad Zeeshan
This article explains how you can use ASP.NET (C#) and search for related queries in your Database.
10 Jul 2014 by Ray Andefi
research to create software and hardware
21 May 2014 by Arvind Singh Baghel
Import CSV or txt File Into SQL Server Using Bulk Insert.
15 Apr 2014 by Ashok8033
Hi ,http://technet.microsoft.com/en-us/library/ms403375(v=sql.105).aspx[^]In SQL Server 2008, all user-created databases are always full-text enabled and cannot be disabled. Regards,Ashok Kumar,
2 Apr 2014 by Kinyanjui Kamau
I have written this tip to help developers automatically set Crystal Report parameters from variables in code (WinForms) at report run time.
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 ...
16 Mar 2014 by ankitkamdar
I Have Installed Sql Server 2008 Full Edition And Also Full-text Search is installed. but the option is disable how to enable it.I Check Via this query SELECT DATABASEPROPERTY('DivineCampus','IsFulltextEnabled')and it return result 1;
15 Mar 2014 by Mehdi Gholam
Read this : http://technet.microsoft.com/en-us/library/ms142536%28v=sql.105%29.aspx[^]also this : http://stackoverflow.com/questions/250844/how-can-i-enable-full-text-indexing-using-sql-server-management-studio-in-sql-se[^]
15 Mar 2014 by ankitkamdar
I Have Installed Sql Server 2008 Full Edition And Also Full-text Search is installed. but the option is disable how to enable it.I Check Via this query SELECT DATABASEPROPERTY('DivineCampus','IsFulltextEnabled')and it return result 1;any one have idea about it than please solve it...
13 Mar 2014 by Maciej Los
Have a look here: Using comma separated value parameter strings in SQL IN clauses[^]
13 Mar 2014 by GDdixit
hello 2 all ...i have a table in which there are three columns id ProductId SubProductId1 2 12 2 2 3 2 3 4 2 4 5 2 5i want to write an procedure for inserting values in table given above here SubProductId...
8 Mar 2014 by Chirag B
Yes, this was resolved with the same techniques. I had included both folders x86 and amd64 in my project root folder with all related dlls inside it. Sorry for not updating this earlier.
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.
4 Mar 2014 by Shivprasad koirala
24 Feb 2014 by ArunRajendra
My logic would be to do calculation using minutes and then convert the result to hours and minutesex: if y is the result the time could be got as y%60+':'+y/60NOTE: the code is not tested I have just given the logic.
24 Feb 2014 by Kornfeld Eliyahu Peter
http://msdn.microsoft.com/en-us/library/ms174420.aspx[^]
24 Feb 2014 by Hunain Hafeez
i wrote this code to find difference between TotalRequiredHours -TotalHoursWorked =192 - TotalHoursWorked=186:04 gives result = 5.933334, , it returns result, Hours are right but minutes part seems to be incorrect. e.g. why ? how to find exact minutes part like int his format...
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...
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...
20 Feb 2014 by Raul Iloc
You have to change the type of your parameter into int:Declare @emplEmail int
20 Feb 2014 by King Fisher
just run itPROCEDURE [dbo].[GetEmailAdd_Sp] @emplid int ASBEGIN Declare @emplEmail varchar(50) -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; Set @emplEmail = (Select emailAdd from...
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.
20 Feb 2014 by Hunain Hafeez
when i execute my store procedure:PROCEDURE [dbo].[GetEmailAdd_Sp] @emplid int ASBEGIN Declare @emplEmail varchar(50) -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; Set @emplEmail =...
19 Feb 2014 by OriginalGriff
Best way is not to store numeric values as strings: Either record it as a floating point value in hours (so 6 hours 15 minutes is 6.25) or as a number of minutes worked.Every time you store numbers, dates, or any other "processable" value in string based columns, you end up giving yourself...
19 Feb 2014 by Hunain Hafeez
FUNCTION [dbo].[GetTotalSalary1_func] ( @emplID int, @month VARCHAR(50) = NULL)RETURNS intASBEGIN Declare @BSalaryHour int, @TotalSalary int, @TotalHoursWorked int Set @TotalHoursWorked = (Select OverallTime from MonthlyRecord where EmplID = @emplID AND Month = @month...
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...
14 Feb 2014 by Hunain Hafeez
Declare @StartDate Date, @EndDate Date, @mydate dateSet @mydate = GETDATE()Set @StartDate = (SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(@mydate)-1),@mydate),101))Set @EndDate = (SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,@mydate))),DATEADD(mm,1,@mydate)),101)) SELECT...
14 Feb 2014 by Siva Hyderabad
How to get Number of days In a month excluding Sunday's without passing any parameter in sql server[^]
14 Feb 2014 by Hunain Hafeez
i am trying using this query t calculate total days in a month but what i want is to select total days in month excluding Sundays. I want total days in month which should not include Sundays. Query:select day(EOMonth(GETUTCDATE())) as TotalDays
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...
28 Jan 2014 by Karthik_Mahalingam
Try this..declare @table table(EnteredDate datetime , Item varchar(55))insert into @table( EnteredDate , Item ) values ( GETDATE(), 'Bags')insert into @table( EnteredDate , Item ) values ( GETDATE(), 'Bags')insert into @table( EnteredDate , Item ) values ( GETDATE()-1,...
28 Jan 2014 by Garth J Lancaster
can you use a cast and cast it to format '103' for example http://technet.microsoft.com/en-us/library/ms174450.aspx[^]'g'
28 Jan 2014 by qbndl8
Hello:I have the following tableEnteredDate Item1/2/2014 12:01:59 PM. Bags1/2/2014 12:02:54 PM. Bags1/3/2014 12:04:55 pm. ShoesI want to return the following count:1/2/2014 Bags 21/3/2014 Shoes 1I can do the select and count query but...
27 Jan 2014 by Jorge J. Martins
Hi, assuming that after the first name you have a space you can try this:SELECT LEFT(Empname, CHARINDEX(' ', Empname) - 1) AS FistName FROM YourTable
27 Jan 2014 by Kornfeld Eliyahu Peter
27 Jan 2014 by GDdixit
hi ....i have a table in which i am entering employee full name in one column ... like this - id Empname LoanSubscriptionDate IsActive 1 Rohit Kumar 30/12/2013 1 2 BabuLal Tiwari 4/08/2012 ...
27 Jan 2014 by Matt T Heffron
SQL-CE runs in-process and is NOT for shared DB applications. (More for kiosk or stand-alone applications.)SQL Server Express is the free edition of SQL Server:Download SQL Server 2012 Express with SP1[^]
27 Jan 2014 by Vedat Ozan Oner
don't use SQL-CE. this is not for such things. you need a database server which serves as data source over a network :) search google with "database server"
27 Jan 2014 by Emre Ataseven
I don't have so much experience on DBMS. I made a program with C# that uses SQL-CE as database, it works perfect, but I want to use shared database with my friend. When I moved to database sdf file to shared folders when I insert or update a row it gives an exception;There is a file sharing...
23 Jan 2014 by Christian Graus
A discussion of ways to create random number sequences in SQL Server
23 Jan 2014 by Bart-Jan Verhoeff
An easy way to access your SQL compact edition database in C#
21 Jan 2014 by Christian Graus
A description of the best way to create tally tables, and how to use them
19 Jan 2014 by Sergey Vaselenko
Use DATEDIFF function like this:SELECT CAST(41657 AS datetime)SELECT DATEDIFF(DAY, 0, CAST(41657 AS datetime))
19 Jan 2014 by Christian Graus
You are converting a date to a string, then trying to cast to int. That makes zero sense.convert(int, getdate())will do it, if it's possible.What do you expect to get ? How do you expect the int to relate back to the date ? Are you sure you don't want the day, month or year...
19 Jan 2014 by ankush1989
I am getting this error while converting to int datatype I am using query this to convertCAST(CONVERT(VARCHAR(8),GETDATE(),112)AS INT)but getting this error .. ?Error:\'Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query.'
16 Jan 2014 by Christian Graus
Discussion on pivot and other ways to turn columns of data in to rows in SQL Server
15 Jan 2014 by shwetap07
I am having textboxes that are placed in order of 6x10 matrix. wants to insert value in database with condition where user may enter values 1 or 2 or so on.. number of rows. If am using "union all" then it inserts blank row records... If going for paramaterized query will i have to specify name...
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.
14 Jan 2014 by Kush R
Hello,You can refer this link in detail : https://www.simple-talk.com/sql/t-sql-programming/null-friendly-using-sparse-columns-and-column-sets-in-sql-server/[^]
14 Jan 2014 by thatraja
Quote:I came to know the problem with my above code that will turns into sql injection... Can you please provide me link for sql parameterized queries tutorial...Check this articleHack Proof Your ASP.NET Applications From SQL Injection[^]Quote:how do i add records in one "insert" command...
14 Jan 2014 by ankush1989
Like giving default value as NULL while inserting column from another table .. ?
13 Jan 2014 by Christian Graus
A discussion of windowing functions, from sum to row_number(), to the new functions in SS2012
13 Jan 2014 by shwetap07
i having 5 textboxes for each fields e.g 5 textboxes for serial no,length range and so on...how do i add records in one "insert" command instead of writing 5 lines of "Insert" Commands...here i used "IF-Else" statement to check whether the user had selected multiple rows insertion or just a...
12 Jan 2014 by Christian Graus
In this third installment, we look at how Common Table Expressions can simplify your SQL and help you perform complex tasks
8 Jan 2014 by Maciej Los
Have a look here:Get time difference in the format "HH:MM:SS" for two different DateTime values in SQL Server[^]how to display hh:mm format using DateDiff() function[^]
8 Jan 2014 by riteshsingh_jsr
Try this:SELECT DATEDIFF(hour,'2014-01-01 03:24:16','2014-01-2 04:24:16')exact which u want:-DECLARE @INT INTSET @INT = DATEDIFF(SECOND,GETDATE(),GETDATE()+1)select convert(varchar(10), (@INT/86400)) + ':' + convert(varchar(10), ((@INT%86400)/3600))
8 Jan 2014 by RKparmar
Hii ,i want output like : 15:35 (HH:MI) OR 00:25 (HH:MI)In date diff how i get this output in between two dates?i have two dates : 2014-01-07 08:41:00.000 2014-01-07 17:29:00.000Thank you ,
8 Jan 2014 by Abhinav S
Try http://www.reflectionit.nl/Blog/2004/datediff-function-in-c[^].
8 Jan 2014 by Sandip.Nascar
The connection string looks to be wrong - Here are some examples which might help you,//Standard SecurityServer=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;//Connection to SQL Server InstanceServer=myServerName\myInstanceName;Database=myDataBase;User...
8 Jan 2014 by OriginalGriff
Exactly why that doesn't work is going to be down to you, for the most part.The important thing is not to use anonymous catches - you are throwing away information you need in order to solve this.Instead of writing: Catch MessageBox.Show("Database not connected") ...
8 Jan 2014 by shwetap07
please help me with the following codeDim conn As SqlCeConnection = Nothing Try conn = New SqlCeConnection("Data Source = MyDb.sdf; Password =''") conn.Open() Dim cmd As SqlCeCommand = conn.CreateCommand() ...
6 Jan 2014 by Christian Graus
Just a quick explanation of why it's not always a good idea to use DISTINCT
3 Jan 2014 by Amol_B
Hi,This should help you.A.Datetime,B.Datetime from (select ROW_NUMBER() OVER (ORDER BY Datetime) AS RowNumber,Datetime1 from table1 ) AS A LEFT JOIN (select ROW_NUMBER() OVER (ORDER BY Datetime) AS RowNumber,Datetime1 from table1) AS B ON B.RowNumber =...
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...
2 Jan 2014 by Sergey Vaselenko
If you have installed SQL Server Compact 4.0 on the target machine, your app must work without additional installations.If you want to distribute your app with embedded SQL Server Compact, do the following:1. Add "C:\Program Files\Microsoft SQL Server Compact Edition\v4.0\Private"...