November 2005 - Posts

Writing Marathon Complete!
30 November 05 09:19 PM | Scott Mitchell

Today I emailed off the final chapter of my latest ASP.NET book to my editor, a feeling that is second only to receiving the first copy in the mail. The book is still far from done - there's editing from the publisher's side, then author review, and then layout, printing, and distributing, meaning it will probably be at least another three months before you can pick up a copy of the book at your local bookstore. But the writing, save for edits in the author review, is over! Done! Finito!

The book I just completed - and, yes, saying that never gets old, not in this post at least - is Sams Teach Yourself ASP.NET 2.0 in 24 Hours. It takes an ASP.NET novice from no experience with ASP.NET to creating a fully-functional, real-world online photo album, covering programming concepts, collecting user input, working with SQL Server 2005 Express Edition, using the SqlDataSource control, editing, inserting, deleting, and viewing data with the GridView and DetailsView controls, using master pages, and understanding site navigation, using Membership.

The first 35% of the book's material was written quick enough as I was able to update the same material from my other book, Teach Yourself ASP.NET in 24 Hours. But the last 65% was all new content, in more ways than one. For starters, I, like everyone else, was learning ASP.NET 2.0 while writing this book. So things didn't progress as quickly as they would have if, say, I started writing this book two years from now. (For example, writing ASP.NET Data Web Controls was a virtual walk in the park since I started it after years of ASP.NET 1.x experience.) Needless to say, this book took a lot out of me, more so than books in the past, in part, I think, because while I was writing this particular title I was also doing consulting work two to three days a week, whereas with past books I dropped consulting work altogether during the two to three months it takes to churn out a book.

Regardless, I'm done writing now, and that's that!

Survey: Best/Coolest New Features in ASP.NET 2.0?
16 November 05 08:36 PM | Scott Mitchell

I'm interested in what y'all think the “best” and coolest new features of ASP.NET 2.0 are. By “best” I mean, what feature will allow you to best get your work done; by coolest I mean what feature blows people's socks off. And let's stick to just ASP.NET 2.0 features, leaving Visual Studio 2005 features for another entry.

For me, I'm not sure what the best feature would be yet, I've not used 2.0 to create any real-world applications. My hunch is that the provider model is going to be high on the list (at least initially), allowing me to more easily move over existing applications with existing membership, role, profile, and site navigation solutions to take advantage of 2.0's new Web controls.

For the coolest feature, the one thing that always seems to impress my students the most is the GridView's built-in capabilities coupled with the ease of data access from the SqlDataSource. Being able to go from a blank page to a pageable, bi-direction sortable, editable, deletable interface in about 35 seconds leaves many jaws on the floor the first time it's demoed. Granted, creating real-world apps involves more than 35 seconds since they shouldn't be using SqlDataSource controls and should include various validation and other business rules for editing and deleting, but the demo still does get 'em every time! :-) (There are plenty of other “cool” things about ASP.NET 2.0, but I think the fact that this one can be done quickly, results in pretty pictures and easy to see highlights, and basically takes a task that takes 35 minutes in ASP.NET 1.x is what drops the jaws.)

Filed under:
Inserting with a SqlDataSource Using uniqueidentifier Parameters
16 November 05 03:24 PM | Scott Mitchell | 1 comment(s)

Scenario: Creating a page with an editable GridView or insertable DetailsView (or FormView) that uses a SqlDataSource whose contens are generated through the Configure Data Source wizard. Specifically, the SqlDataSouce's SELECT statement returns a column of type uniqueidentifier (a GUID), and the wizard is configured to automatically generate the INSERT, UPDATE, and DELETE statements as well.

Problem: When updating or inserting into the GridView or DetailsView (or FormsView) I get an “Implicit conversion from data type sql_variant to uniqueidentifier is not allowed. Use the CONVERT function to run this query” exception.

Solution: According to FormView Control, SqlDataSource, and 'Procedure or Argument has too Many Arguments Specified', It appears that this particular problem (or something similar) was a bug back in Beta 2 that (sadly) made it to RTM.

The crux of the problem, it appears, is that the <asp:Parameter> value for the uniqueidentifier field is, by default, set to Type=”Object”. To fix this, simply remove the Type property altogether. That is, change the SqlDataSource parameter setting from something like:

<asp:SqlDataSource ...>
<InsertParameters>
<asp:Parameter Name=”UserId” Type=”Object” />
...
</InsertParameters>
</asp:SqlDataSource>

to:

<asp:SqlDataSource ...>
<InsertParameters>
<asp:Parameter Name=”UserId” />
...
</InsertParameters>
</asp:SqlDataSource>

This change worked for me; once the Type was removed the exception ceased and the updates/inserts worked as expected.

Hope this helps some folks...

Filed under:
The Microsoft Korean Rap
11 November 05 02:19 PM | Scott Mitchell

This little ditty sure is making the rounds today - it's a team of Korean developers “singing” the praises (get it? :-p) of Visual Studio 2005.

I think.

They're singing something, for sure, and apparently are having a grand ol' time doing it.
http://www.microsoft.com/korea/events/ready2005/vs_song.asp

UPDATE [2005-11-11 2:29 PM GMT-8]: Whoa, the lyrics to the rap are on the page down at the bottom. Pretty hilarious. I think the following verse sums up the feelings of developers worldwide:

The hunger that I tormented me while working nights
The desperation that I got after knowing I lost all the coding work that I put in
Now, things have changed
Take the opportunity for taking my idea to fly high
The VS 2005 is finally reborn

And the song ends with, “And We will take the flowers of hope to fruition, even bigger than ever before.”

Visual Studio 2005... obviously one hell of an IDE.

Filed under:
Random AdSense Tip
10 November 05 08:59 AM | Scott Mitchell

A couple months back I was talking to Scott Hanselman and the coversation about blogs and advertising through Google AdWords came up. As you can see, both Scott's blog and mine both don Google AdWords. Anyway, I mentioned that the results were pretty pitiful, and Scott suggested that I take the ads and make sure that the background color and link color of the ads was the same as the background color and link color where they appeared on the page. In other words, don't use a different background color and link color to “offset” the ads; rather, make them look like part of the normal page.

Rather than just take his word on it, I decided to setup a little experiment. I have two Google Ads on my blog - one in the left hand column, shown on all pages except when viewing a post, and the other when viewing a post, wedged between the blog content and where the comments begin.

The left hand column of my blog has a white background. To test Scott's hypothesis about having the same background color, over the past six weeks or so I've randomly display the ads with either a white background or a dark gray background (matching the center column's background color). The results? Scott was right on the money: the white background had five times as many click throughs as the dark gray background. (Don't get too excited, we're talking about making enough per day now to buy a cup of coffee, versus making enough to buy a pack of gum. But still, no complaints, I'll take it.) As you may have guessed, I've now ended my experiment - all ads shown on the left column now have a white background.

The other test I ran was when viewing a particular blog post. For that ad section I kept the background color of the ads the same color as the actual background (dark gray), but varied the link color, using black links for one and blue links (the actual link color on my blog) for the other. The results? The click throughs were nearly identical; while the black link test had a very slight increase in click throughs, I doubt the increase is statistically significant.

So if you run your own site using AdWords, consider making the ad background color the same background color of your site so that the links blend in instead of standing out. With any luck, you'll see your click throughs increase several times over as well.

Filed under:
Problems Installing Management Studio with SQL Server 2005 Standard and Express
09 November 05 08:50 AM | Scott Mitchell

On Monday of this week (Nov. 7th), Microsoft officially released .NET 2.0 (including ASP.NET 2.0), Visual Studio 2005, and SQL Server 2005. In fact, my most recent 4Guys article, Working with Databases in ASP.NET 2.0 and Visual Studio 2005, examines how to connect and display data from a SQL Server 2005 database from an ASP.NET 2.0 page.

Like Visual Studio 2005, SQL Server 2005 comes in a number of product lines. There's the free “Express” version that ships with Visual Studio 2005 (or can be downloaded independently) along with a Workgroup, Standard, and Enterprise versions. You can compare the featuresets of the various versions here.

One slight annoyance is that SQL Server 2005 Express edition does not (at this time) ship with Management Studio. Management Studio is the slick new name for what was called Enterprise Manager in SQL Server 2000 - basically a stand-alone GUI Windows application for managing SQL Server databases. Since SQL Server 2005 Express edition lacks the Management Studio, you will most likely create and modify your SQL Server 2005 Express databases directly through the Visual Studio 2005 IDE. (I discuss this in greater detail in my 4Guys article.) There will be, however, a Management Studio Express version; currently it's being released as a Community Technical Preview (CTP); learn more from this blog entry by Euan Garden.

SQL Server 2005 is designed to allow side-by-side installations, both with its varying versions and previous versions of Microsoft SQL Server. When setting up my desktop for .NET last week I installed, first, Visual Studio 2005 Professional edition, which prompted me if I wanted to also install SQL Server 2005 Express edition. Being a rather genial fellow, I said, Sure. After installing VS 2005, I decided to install SQL Server 2005 Standard edition. After installing it I noticed that I did not have Management Studio installed. Weird.

I went to the Control Panel, then Add/Remove Programs, and chose Microsoft SQL Server 2005. Next I was asked to choose an instance (SQL2005 or SQLEXPRESS). I chose SQL2005, since that instance is what supports Management Studio. I then stepped through a few more screens until I reached a screen where there was a Customize button to tailor the installation options. Clicking this displayed the familiar tree of installation options, but, to my surprise, there was no Management Studio option. In talking with others, I found that they had a Management Studio option.

Turns out, from the first screen where I chose an instance (SQL2005 or SQLEXPRESS) there was a link up at the top that read, “To install a new component, click here.” (Screenshot shown below.) I needed to click that particular link to configure the SQL Server 2005 setup to install Management Studio. Seemed odd to place this link here in this screen, as it breaks from the standard UI paradigm used in countless other installation wizards. (Thanks to Adam Sills for helping me get the Management Studio installation working.)

Filed under:
More Posts

Archives

My Books

  • Teach Yourself ASP.NET 4 in 24 Hours
  • Teach Yourself ASP.NET 3.5 in 24 Hours
  • Teach Yourself ASP.NET 2.0 in 24 Hours
  • ASP.NET Data Web Controls Kick Start
  • ASP.NET: Tips, Tutorials, and Code
  • Designing Active Server Pages
  • Teach Yourself Active Server Pages 3.0 in 21 Days

I am a Microsoft MVP for ASP.NET.

I am an ASPInsider.