Click here to Skip to main content
6,934,113 members and growing! (13,118 online)
Email Password   helpLost your password?
Database » Database » Utilities     Intermediate License: The Code Project Open License (CPOL)

SQL Server CE Query Tool

By ray_mayukh

User friendly query designer and data manipulation tool for SQL Server CE
C# (C#3.0), Windows (WinXP), SQL-Server (SQL-CE), DBA, Dev
Revision:6 (See All)
Posted:16 Feb 2009
Updated:30 Apr 2009
Views:28,941
Bookmarked:55 times
printPrint Friendly   add Share
      Discuss Discuss   Broken Article?Report  
17 votes for this article.
Popularity: 5.45 Rating: 4.43 out of 5

1

2
2 votes, 11.8%
3
2 votes, 11.8%
4
13 votes, 76.5%
5
CEQuery-Installer- Click to enlarge image

Introduction

CEQuery is written in C# with the help of Visual Studio 2008 platform. Some of the features of this tool are described below:

  • User is able to create CE database. If the schema is provided, the tool is able to create the tables and columns.
  • User is able to overview an existing CE database with its table and column structure in tree format.
  • User can design a query by dragging and dropping tables and columns from the database tree. The query pane in the tool is able to hold multiple queries provided that only one of those queries is active [As SQL Server CE engine does not support multiple queries in a single statement]. The tool is able to handle multiple query panes in the form of tabs. The query designer of the tool is able to highlight the keywords. The tool is able to handle the execution of user's selected query.
  • User can manipulate [Insert/Update/Delete] records in a selected table.
  • User is able to generate scripts from a single table or multiple selected tables. [Both for SQL CE or SQL Server]
  • User is able to open multiple SQL Server CE files simultaneously.
  • User is able to convert a SQL Server database to a SDF file with schema and data.
  • User is able to change password of a SQL CE DB. The tool is now capable of handling the database with no password.
  • User is able to Create or Delete Table by wizard.
  • User is able to Export Query Result.

Background

In one of my projects, I have to use SQL Server CE database rigorously as the application interacts with the local version of SQL Server CE file for displaying and manipulating data. SQL Server CE 3.5 version has been used in the application. The application is built on Visual Studio 2005 platform with the support of .NET Framework 2.0. I was initially faced with some problem for querying the SQL Server CE files. Following are the reasons for creating a separate tool for querying a CE database:

  • SQL Server 2005 Management Studio does not support querying SQL Server CE 3.5 or SP1 database for displaying contents and querying data.
  • There are no free tools for querying CE database available on the internet.
  • The only option to view the content of a CE database file is to install VS 2008 which has built in support for viewing and querying a CE database. But the UI provided for querying a CE database in Visual Studio 2008 is not a user friendly one. We need to type hell lot of things for querying a table. Users who are using SQL Server Management Studio will be very uncomfortable with Visual Studio 2008 for querying CE database.

So to manage the queries for CE database, the concept of writing a new tool comes to mind. As SQL Server CE architecture is completely written in C#, there should not be any problem to write a small new tool in a short time period. The main aspects of the tool are as follows:

  • The tool should be able to view the table and column structure in a CE database.
  • User should be able to design a query in less time like dragging and dropping table names and column names in the query pane from the DB tree like SQL Server management studio.
  • The tool should be able to create a new blank CE database. If a schema file is provided, the tool should be able to create tables and columns in the database.
  • The user should manipulate data [like Insert/Update/Delete] in any table from the tool.
  • The user should generate a script for individual table as well as the whole database.
  • The user should be able to place multiple queries in a single query pane. Also she/he should be able to use multiple query panes.
  • The query editor should highlight the keywords in the query so that the user should feel like using SQL Server Management Studio.

Using the Code

A brief description of how to use the article or code has been provided in the help [CEQuery-Help.zip] file attached with this article.

Points of Interest

The following articles were very helpful in terms of learning for me:

You need to have SQL Server CE 3.5 installed to run the code.

Improvement in the Latest Version

The latest version of CEQuery has some enhancements as well as bug fixes. The suggestions from users have been the keen interest for posting the new release.

Enhancements

  • Convert SQL Server database to SQL CE database with schema and data
  • Password change and Blank password support for the SQL CE DB
  • Generate schema and data script for SQL Server
  • Run highlighted code only
  • Undo and some extent of Redo functionality in SQL editor
  • New: Create/Delete Table
  • New: Export Query Result in XML Spreadsheet
  • New: Script Generator with flexibility of table selection

Bug Fixes

  • Bug 1: Multi-column FKs not supported in generated schema files
  • Bug 2: nVarChar field sizes omitted / lost in generated schema files
  • Bug 3: Blank passwords not supported when creating new DB file
  • Bug 4: Creating new database from schema file is broken after any editing of the schema file (doesn't handle empty lines)
  • Bug 5: Datatype Error for varchar

History

  • 30th April, 2009: Updated code base and installer
  • 27th April, 2009: Third release
  • 18th March, 2009: Second release
  • 16th February, 2009: First release 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

ray_mayukh


Member

Occupation: Software Developer
Location: India India

Other popular Database articles:

 
Article Top
 
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 66 (Total in Forum: 66) (Refresh)FirstPrevNext
GeneralIdentity attribute [modified] PinmemberTony Vaughan11:29 17 Feb '10  
GeneralRe: Identity attribute Pinmemberray_mayukh10:31 24 Feb '10  
GeneralThank you for a great application PinmemberTony Vaughan9:27 17 Feb '10  
GeneralRe: Thank you for a great application Pinmemberray_mayukh10:32 24 Feb '10  
GeneralU are great man!! PinmemberAlexForex4:33 4 Feb '10  
GeneralRe: U are great man!! Pinmemberray_mayukh9:44 4 Feb '10  
GeneralPrivate assembly - CE 3.5 PinmemberPeterJT302:35 28 Jan '10  
GeneralRe: Private assembly - CE 3.5 Pinmemberray_mayukh20:25 3 Feb '10  
GeneralExport to sql column length Pinmemberbader8:48 22 Dec '09  
GeneralRe: Export to sql column length Pinmemberray_mayukh2:22 14 Jan '10  
GeneralA great little utility... PinmemberRobS7513:16 2 Dec '09  
GeneralRe: A great little utility... Pinmemberray_mayukh8:21 10 Dec '09  
GeneralSQL Server 2008 Management Studio does it as well PinmemberSimon Mourier2:58 16 Nov '09  
GeneralRe: SQL Server 2008 Management Studio does it as well Pinmemberray_mayukh6:58 17 Nov '09  
GeneralRe: SQL Server 2008 Management Studio does it as well PinmemberSimon Mourier7:14 17 Nov '09  
GeneralGetting 'Requested value 'NO' was not found. Pinmemberpedribe4:26 6 Oct '09  
GeneralRe: Getting 'Requested value 'NO' was not found. Pinmemberray_mayukh22:00 7 Oct '09  
GeneralUnable to download CEQuery-Code Pinmemberevandrix6:32 5 Oct '09  
GeneralRe: Unable to download CEQuery-Code Pinmemberray_mayukh21:37 7 Oct '09  
GeneralConverting Sql server express 2005 database to sql server ce PinmemberDude from backyard7:15 30 Aug '09  
GeneralRe: Converting Sql server express 2005 database to sql server ce [modified] Pinmemberray_mayukh2:04 3 Sep '09  
GeneralUnable to load DLL 'sqlceme35.dll' 64 bit Pinmemberfrankpearson12:59 15 Aug '09  
GeneralRe: Unable to load DLL 'sqlceme35.dll' 64 bit Pinmemberray_mayukh10:30 16 Aug '09  
I have written the application in 32 bit system. I have never tried this in a 64 bit machine. Also the installer has been build targetting the 32 bit machine. I will do some analysis on this issue. Thnx a lot for pointing this.
GeneralThat's awsome... Pinmembermonkeylover212:26 12 Aug '09  
GeneralRe: That's awsome... Pinmemberray_mayukh10:28 16 Aug '09  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+PgUp/PgDown to switch pages.

PermaLink | Privacy | Terms of Use
Last Updated: 30 Apr 2009
Editor: Deeksha Shenoy
Copyright 2009 by ray_mayukh
Everything else Copyright © CodeProject, 1999-2010
Web10 | Advertise on the Code Project