Doug Reilly's Weblog

Embedded Reporting of the Information Age...

.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?

 

Comments

Nino Benvenuti said:

Hello, Doug. Glad to hear from another .NETCF developer. It has improved quite a bit since the first SDE 'add-on' beta for VS.NET 2002. There are a few of us who have created Pocket PC apps prior to VS.NET 2003; granted the environments were not as friendly - development or debugging. The emulator is much improved and the debugger is quite nice (comparatively). Things get even better for the developer with Ozone (Pocket PC 2003); I saw quite a few nifty things at MDC in March.

A few thoughts about your "what's not to like" items: I agree, a bit of a drag that there are no sprocs or views in SQL CE. Using parameterized queries and the TableDirect CommandType are helpful. :) If, however, sprocs in your device db is important, there are other alternatives to SQL CE. Sybase iAnywhere and IBM DB2 Everyplace are two that come to mind. I was able to talk with Kevin Collins, the Senior Program Manager for SQL CE, at MDC about some of these issues; he assured me that the team was working on these. [My particular concern was manipulation of the .sdf on the desktop/server, as my client was not using RDA or Merge Replication (and I've had several projects since that are not either), and there were challenges in getting data loaded into SQL CE]

Limits to the power of the UI components.. yeah.. some of it..just wasn't that important to fit in the first rev of NETCF. Other items that people have complained about (not just UI items), XSLT transforms being one example, are not appropriate on the Pocket PC platform. A Pocket PC device has limited resources (CPU and memory, and hence, battery life) such that somethings are just not practical; these items should be handled on the server or desktop.

My point being to be cognizant of the fact that you are on a mobile platform, and of its constraints. This is something that some developers forget, then complain about how poor performance their app exhibits because they are
# May 14, 2003 8:52 PM

Nino Benvenuti said:

*sigh* my comment was too long to fit in one post...

My point being to be cognizant of the fact that you are on a mobile platform, and of its constraints. This is something that some developers forget, then complain about how poor performance their app exhibits because they are doing something that shouldn't be done on a Pocket PC. Just some thoughts of mine; I'm not being critical of you. I'd be happy to entertain any questions you might have about NETCF.

Lastly, (yeah, this is a long comment) you may want to check out the following resources:
Fellow dotnetweblogger Anil John has http://www.learnmobile.net Also, http://www.opennetcf.org, http://samples.gotdotnet.com/quickstart/CompactFramework/, and
http://www.gotdotnet.com/Community/MessageBoard/MessageBoard.aspx?ID=275

-Nino
# May 14, 2003 8:53 PM

Douglas Reilly said:

Yes, it is certainly important to always keep in mind that you are working on a portable device.

My particular project I was working on actually did require a pretty large database. It is a Paint Prescription database (don't get me started on how complex prescriptioning is). An appreviated copy of the database is about 35 Meg (placing it on a SD card makes this possible even on my lowly T-Mobile Pocket PC Phone). The performance is really tolerable given the platform.

However, even if developers understand the limitations, others (those pesky users) likely will not. And there is the rub. We will continue to develop applications and say, "Hey, this app returns a Color Prescription in 2 seconds!", while our users will say, "Hey, this app takes 2 seconds to return a Color Prescription!".

Honestly, I found the limitations of the components (the Drop Down list limits, limits to formatting and sizing columns on the grid, etc.) to be more troublesome than the SQL limitations. That could be because I am more of a db programmer than a UI programmer, and so working around the limitations of the DB is easier for me than working around the UI limitations.
# May 14, 2003 9:15 PM

Nino Benvenuti said:

35 MB .. ouch! You are absolutely correct, Doug... the user can ruin your day. Then again, there's something to be said for perceived performance (as opposed to actual performance) ;)

I concur, some the UI widgets can be a real PITA. For example, adding a number of items to a ListBox and be painful...there is no BeginUpdate / EndUpdate. My SQL CE pain had to do with loading flat files into the db...

-Nino
# May 14, 2003 9:43 PM

Chris Durbin said:

I have run into a snag using SQL in VB.net on my Dell Axim 2003 pocket PC. I run a program that presells and does invoicing (including printing the invoice). Then it sends the data to an AS/400 server. The AS/400 sends down a zip file to my device. I disconnect and recreate my data on the device. While I am reading the data from the uncompressed zip files (flat files seperated by "|"'s and loaded into an array, I get to the following line:

InsertRow.ExecuteNonQuery

It runs for the first 5 or 6 lines and then I get "A Managed MissingMethodException Occurred" error.

InsertRow is defined as follows with ssceconn as my database connection

Dim insertRow As SqlCeCommand = ssceconn.CreateCommand()

The three things I do not understand are:

1. If there is a missing method, why does it write out several records before I get the error?

2. I dumped the data and I can key it in using the Query Analizer on my device and the data goes through.

3. If I delete my database and rerun the program, it will process all of my records and give me no error.

I am using this on several devices. Any suggestions on what my problem might be?

# July 16, 2004 5:47 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)