Wow! I just took a break from work and watched the space shuttle launch. Amazing. Beautiful. Awesome. Words can’t do it justice. My wife and kids went to TechEd with me this year, and while we were there, we toured the Kennedy Space Center and got a close-up look at the two space shuttle launch pads (which happen to be the same pads used for the Apollo moon missions). It made this morning’s launch more exciting.

If you watched the launch on Fox News, you saw a shuttle astronaut named Tom Jones providing commentary. Tom has flown on four shuttle missions. My son and I met him and had our picture taken with him last month at Kennedy Space Center. Tom gave us a first-hand account of what the first couple of minutes after launch is like. (Lots of shaking and rattling.)

On a slightly different subject, this weekend I put the finishing touches on the final edits to October’s Wicked Code column. The subject: asynchronous pages in ASP.NET 2.0. There’s very little documentation on the subject in beta 2 (or in the trade magazines), but async pages are ultra-cool and are something EVERY ASP.NET developer should know about. Here’s the code-behind class for an async page that uses async ADO.NET to do asynchronous data binding:

public partial class AsyncDataBind : System.Web.UI.Page
{
    private SqlConnection _connection;
    private SqlCommand _command;
    private SqlDataReader _reader;
   
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            // Hook PreRenderComplete event for data binding
            this.PreRenderComplete += new EventHandler(Page_PreRenderComplete);

            // Register async methods
            AddOnPreRenderCompleteAsync(
                new BeginEventHandler(BeginAsyncOperation),
                new EndEventHandler(EndAsyncOperation)
            );
        }
    }

    IAsyncResult BeginAsyncOperation (object sender, EventArgs e, AsyncCallback cb, object state)
    {
        string connect = WebConfigurationManager.ConnectionStrings[“PubsConnectionString”].ConnectionString;
        _connection = new SqlConnection(connect);
        _connection.Open();
        _command = new SqlCommand(“SELECT title_id, title, price FROM titles”, _connection);
        return _command.BeginExecuteReader (cb, state);
    }

    void EndAsyncOperation(IAsyncResult ar)
    {
        _reader = _command.EndExecuteReader(ar);
    }

    protected void Page_PreRenderComplete(object sender, EventArgs e)
    {
        Output.DataSource = _reader;
        Output.DataBind();
    }

    public override void Dispose()
    {
        if (_connection != null)
            _connection.Close();
        base.Dispose();
    }
}

That’s just one way to leverage the new async features of Whidbey. Lots more in October’s Wicked Code.