Insufficient data from Andrew Fryer

The place where I page to when my brain is full up of stuff about the Microsoft platform

Web Development & SQL Server Express part 3 – Development

In part 3 of my odyssey into the world of express development I’m ready to actually start development.  I have a virtual machine (vm) with Microsoft’s free web development kit installed which comprises Visual Studio 2008 express for development and SQL Server 2008 express for my data repository.  On top of this I also selected the DotNetNuke application as I wanted to quickly setup some sort of data driven application and this seemed to do the trick.  However I quickly realised that while this is a cool bit of kit it would be better if I grew my own.

At this point I must confess I am not a developer, so I resorted to the tutorials on web development on MSDN to see what they can do for me.  I jumped in at lesson 7 as this is the one where you start to play with data.  The good thing about this is that you get a couple of videos, a transcript and solution code to help you get started. I was puzzled that the tutorial is for Visual Studio 2005 and SQL Server 2005 so when I tried to open it I got this..


This is actually a good thing; the latest .Net framework fully supports earlier versions and Visual Studio allows you to develop in the latest one (3.5 sp1) or .Net 2.  I am going to say yes and upgrade because I ‘m an evangelist.

The scary thing for this ancient dba about this project is that it includes a database which doesn’t show up at all in the SQL Server Express management console, it is simply dynamically attached as part of the project, again this is a good thing if you’re a developer as you have your own sandbox where you can play.  Better yet I can do everything (add tables alter definitions etc.)  I need to in Visual Studio database explorer tab without going to the separate management studio…


It’s also a really simple to bind data controls to this data, in the sample web site Lesson07exercise there is already a blank page (default2.aspx) where we can add some data bound controls. To do this I opened it in design view and from the toolbox select a SQLDataSource..


Which you then configure to pint to that same database, by selecting the Microsoft SQL Dataset file and then browsing to the Grades.mdf file.  You can (and should) elect to save the connection string to the Application Configuration File.  Now I can configure what data I want to select from the tables and columns available, and I can sort and filter these as needed without writing an SQL and there’s a query builder if I want to take data from a combination of tables.  For this noddy demo I’m just going to get a list of the grades for each student.


Now I can bind a data aware control to that data source, in this case I’ll take the gridview control by simply dragging it onto the SQL Data Source I already created.  I still have to choose the data source and then it picks up the data.

I can test this at any time by debugging it , and when I do I get my grid shown up ina browser…


Hopefully that’s convinced you that this is all pretty straightforward and that the Microsoft Web Platform although free has a lot of power behind it.  I would emphasis that if this is really new to you then you will want to do those MSDN tutorials in more depth and follow the work of experts like the resident web developer on our team, Mike Ormond.