SqlCe on the Full Framework

Published Wed, Aug 11 2004 17:11 | William

Not too long ago Casey brought up the question of whether or not SqlCeResultSet will work on the Tablet for instance.  Microsoft said it will. Sam  brought it up again and really has my curiousity piqued.  The only question was HOW TO DO IT.  To that end, I started freestyling and found some neat information.  1)  If you use the same .dll reference that you normally use for SqlCe - it won't work on the full framework.  Not a big shock there.  2)  Microsoft.SqlServerCe.Client will in fact work.  Well, work is  dubious thing.  It will compile and run.  I'm getting a connection string error which is probably the work of something really stupid I'm overlooking.  If this much works though I think the rest will...  So far here it is:

const string CONNECTION_STRING = @"C:\test.sdf";
private void Form1_Load(object sender, EventArgs e)
{
    SqlCeConnection cn ;
    SqlCeCommand cmd = new SqlCeCommand();
    cn = new SqlCeConnection(CONNECTION_STRING);
    try
    {
        cn.Open();
    }
    catch (SqlCeException ex)
    {
       Debug.Assert(false, ex.ToString());
    }
}

I'm getting stuck w/ this error:  "Format of the initialization string does not conform to specification starting at index 0."   But I'm going to call this progress b/c it got nowhere before and it looks like it's merely a connection string problem.  Will post back shortly.

Comments

# William said on September 21, 2004 9:16 AM:

I need to do this too. Where are you today with your progress?

Wayne

# William said on November 9, 2004 2:29 AM:

.NET Compact Framework and SQL CE
Have you installed and started using Visual Studio .NET 2003? If not, if you have a Pocket PC you should run, not walk, to install VS.NET 2003.

VS.NET 2003 has, among many incremental improvements, a breakthrough: The ability to create and more importantly, debug, .NET Compact Framework applications. While it was certainly possible to create Pocket PC applications prior to VS.NET 2003, I do not know many people who have. I think there will be many people who will do so in the future. What is so great about developing with the .NET Compact Framework?

The .NET Compact Framework is a reasonable subset of the full .NET Framework, making it possible to, with some care, create classes that can work on your desktop and your pocket PC.
The VS.NET debugging environment is wonderful to work with. Even if you do not have a pocket PC, you can debug applications on the emulator.
The .NET Compact Framework has a SQL CE data provider that works much like the SqlClient classes on the PC. It is not a perfect match, but it certainly can help limit the learning curve.
So, what's not to like?

SQL CE does not allow use of Stored Procedures or Views. This makes it a little more difficult for me to reuse certain logic that I would normally place in a stored procedure.
There are pretty severe limits to the power of the UI components. Want to change the color of the background on a drop down list? Not supported by the framework. Want an incremental search on a drop down list? Same thing.
Certain operations (notably binding data) that are instantaneous on your PC will be lots slower on the Pocket PC.
The good news for me is that these lapses in what is possible and what the .NET Compact Framework provides means that there is room for an independent developer to cobble together class libraries to support what will be a growing number of .NET Compact Framework Developers.

What do you think?

# William said on January 7, 2005 11:34 AM:

Hi,

I use Whidbey beta 1 and can't find SQL CE...what i'm i missing here?

Search

This Blog

Tags

Community

Archives

News

My other sites

Cool Stuff

Book Stuff

Security

ORM

Data Access

Funny Stuff

Compact Framework Stuff

Web Casts

My KnowledgeBase Articles

My MVP Profile

Design Patterns

Performance

Debugging

Remoting

My Fellow Authors

My Books

LINQ

Misc

Speech

Syndication

Email Notifications