Home   Wordpress   Log in

Archive for January, 2007

Power of the Using Statement

January 25th, 2007 by admin | No Comments | Filed in .NET, Database, Design, Mobile

Where is the best place to Close() a SqlConnection? What about to Dispose() a SqlDataAdapter?

I was writing on some code yesterday when I started getting this compile warning message: (Code displayed below)

Warning 35 Variable ’scon’ is used before it has been assigned a value. A null reference exception could result at runtime.

I said to myself… “Self, this is just a warning… move on.”

As the quantity of warning messages kept growing… I could not take it any more. I had to get ride of those warning messages.

Now… How to do it? I know… Ask Chris Craft, that is what I will do. He explained about the using statement and then sent me this great link.

He explained, that when using the using (sounds weird), after the using statement is finished, the objects will be closed and disposed automatically.

WOW!!! Here is the before and after.

Initial code:

Dim scon As SqlConnection
Dim sda As SqlDataAdapter
Dim scmd As SqlCommand
Dim ds As New DataSet
Dim sql As String = “SELECT * FROM MyTable

Try
    scon = New SqlConnection(constring)
    scmd = New SqlCommand(sql, scon)
    scmd.CommandType = CommandType.Text
    sda = New SqlDataAdapter(scmd)
    sda.Fill(ds, “Blah“)
Catch e As Exception
    Throw e
Finally
    sda.Dispose()     ‘Was giving the warning
    scmd.Dispose()  ‘Was giving the warning
    scon.Close()       ‘Was giving the warning
End Try

Code using the using:

Dim ds As New DataSet
Dim sql As String = “SELECT * FROM MyTable

Try
    Using scon As SqlConnection = New SqlConnection(constring)
        Using scmd As SqlCommand = New SqlCommand(sql, scon)
            scmd.CommandType = CommandType.Text
            Using sda As SqlDataAdapter = New SqlDataAdapter(scmd)
                sda.Fill(ds,”Blah“)
            End Using
        End Using
    End Using

Catch e As Exception
    Throw e
Finally
End Try

The code using the using looks neater, cleaner, and has no warning messages.

Happy 7th Birthday Emilee!!!

January 19th, 2007 by admin | No Comments | Filed in Misc, Personal

Time flys!!! My oldest child, only girl, is now seven.

She is a true blessing to me and I love her very much.

She makes me so proud with her grades and the way she ”plays” little momma to the two younger brothers. 

(A dad gets to brag on his children from time to time)

She navigates on the kid’s laptop pretty well. She can login using her domain user account, type documents in Word, print coloring book pages, and browse the internet. 

She went to the Veggie Tales website yesterday and sent me two e-cards!!!

She uses the family email address for now. I guess soon I will be creating her very own email account…

Then next, her own blog…

Happy Birthday Emilee!!!

Two Cool Tools

January 17th, 2007 by admin | No Comments | Filed in .NET, Software, WebSites

Last week I had the pleasure of meeting Brian Hitney, Developer Evangelist with Microsoft.

We had lunch at Red Bone Alley here in Florence. Then later that evening, he spoke at the PDANUG event.

Anyway… I was browsing his web site the other day and found a couple of cool tools and products.

WorldMaps is a way (Notice on the left side of my page) to visually show your site’s users and where they are located. You have to signup for this service but is way cool. Click on my image and you can see information like White Dots that show the visitors, Red Dots that indicate the highest concentration of visitors, Unique IP address, and unique locations. Did I mention it was free… :-)

SiteSpider is a utility to crawl web sites. It will display broken links and slowest pages. It is also free!!!

Thanks Brian for visiting the Florence, SC area and for the cool tools.

Photomosaic Pictures

January 9th, 2007 by admin | No Comments | Filed in Misc, Personal, Software, WebSites

If you ever wanted to create your own photomosaic, here is your chance. A flickr or yahoo account is needed.

http://start.mosaickr.com/

Incase you are not familiar with the term…

A Photomosaic is a picture made up of smaller pictures. For example, my Yoda photomosaic has hundreds of pictures from Star Wars Episodes IV, V, and VI.

Windows Workflow Foundation (.NET University)

January 4th, 2007 by admin | No Comments | Filed in .NET, Database, Design

I want to personally invite you to attend a free class to learn more about Windows Workflow Foundation. The class will be taught by Brian Hitney who is a Developer Evangelist with Microsoft for South & North Carolina. Before the actual meeting will be free pizza and time to talk with Brian personally about Vista, .NET, or any developer related topic.

Location:
McLeod Medical (here for directions)
800 Cheves St
Florence South Carolina 29506
United States

Tuesday, January 9, 2006
6:00 PM – 8:00 PM (ET)
Topic: .NET University – Windows Workflow Foundation

Event Overview

This class will take place over four consecutive user group meetings: 

11/14/2006 – Windows Cardspace – taught by Page Brooks
12/12/2006 – Windows Communication Foundation – taught by Glen Gordon
01/09/2007 – Windows Workflow Foundation – taught by Brian Hitney
02/13/2007 – Windows Presentation Foundation – taught by Chris Craft

The Pee Dee .NET User Group is proud to present .NET University as a 4-part series during this winter’s meetings!  Join us to get an overview of the next version of the .NET Framework (.NET 3.0), including Windows Communication Foundation, Windows Presentation Foundation, Windows Workflow Foundation, and Windows CardSpace. All topics are covered at a 100-level, and labs will be included with the courseware.

Who am I?

January 1st, 2007 by admin | No Comments | Filed in Misc, Personal, WebSites

Superhero: Green Lantern

Green Lantern

80%
Superman

75%
Spider-Man

45%
Supergirl

45%
Wonder Woman

45%
Robin

45%
Hulk

45%
Batman

40%
Iron Man

40%
The Flash

35%
Catwoman

30%
Hot-headed. You have strong
will power and a good imagination.

Click here to take the Superhero Personality Test

 

Super Villain:Lex Luthor

Lex Luthor

69%
Dr. Doom

66%
Apocalypse

56%
Magneto

44%
Green Goblin

44%
Kingpin

44%
The Joker

42%
Juggernaut

40%
Riddler

33%
Dark Phoenix

31%
Mystique

28%
Mr. Freeze

28%
Venom

21%
Poison Ivy

21%
Catwoman

14%
Two-Face

4%
A brilliant businessman on a quest for world domination and the self-proclaimed greatest criminal mind of our time!

Click here to take the Super Villain Personality Test

Download Full Movie Online Hytrin