June 29th, 2009
I usually hear about these things sooner, but this is the first I recall hearing about it. Link found on a pet group I belong to.
Hundreds of Heartbroken Puppy Buyers Seek To Join Petland Class Action Lawsuit
I don’t normally link to the HSUS site these days, as I’ve heard a lot of garbage about them being in bed with PETA, but I can’t help but be on board with informing people where those poor puppies come from.
Please join us in boycotting PetLand stores. Frankly, I don’t think we’ll ever eliminate commerical breeders, but there has to be a better way to regulate the commercial breeding industry, and consumers should NOT be lied to about where their animals come from.
When purchasing an animal, remember that when it comes to commercial breeders, AKC papers don’t mean anything. A kennel name on a certificate doesn’t mean anything about the nature of the kennel. Commercial breeders have kennel names, and they register their dogs by sending in a piece of paper to the AKC. NO ONE AT THE AKC EVER SEES THOSE DOGS. If you want good, healthy puppies, you need to get them from a reputable breeder, not the local PetLand.
Tags: PetLand, puppy mills
Posted in Dogs | 5 Comments »
June 8th, 2009
Jeffrey* checking out the shelf. With an audience…

Speaking of shelter cats, I came across this link from an online community I belong to.
Find Your Purr-fect Match—Cats Over Three Are Free!
“To help promote the adoption of our older feline residents, the ASPCA is offering adopters the chance to bring home a cat, three years or older, for free!”
The post indicated this was a shelter in New York City, but other shelters may be offering similar programs and the linked article doesn’t give a specific location. Please help save a life — adopt a shelter kitty! June is Adopt-A-Shelter-Cat Month. Pass the word around please!
*The cat pictured above is my Jeffrey. I adopted him as an adult from a local rescue. The eyes in the background are Louie, also adopted as an adult, and Isis, adopted as a feral kitten.
Tags: rescue
Posted in Cats | No Comments »
June 7th, 2009
I can’t think of any other reason a man would want to give owners only 3 days to find their lost cat before they’re killed by the local pound. If I lived in CA, I’d be throwing a less-than-mild fit about this latest bullshit.
CA Governor Wants to Cut 3 Days off Shelter Cats’ Reprieve from Death
From six days down to three days. THREE DAYS?! Shame on you, Arnie. Heartless, reprehensible, and irresponsible. Why do you hate animals, Mr Schwarznegger? Why are you so anxious to see them murdered instead of returned to their families or placed in loving homes?
I’m not unreasonable — I know we can’t save them all. But to only give them three days is terrifying to me as a pet lover. I can just see a family going on vacation only to come home and find their cat escaped or was let out by accident, and the local pound killed him while they were away. I see my Mom’s newly adopted kitty (the awesome Willow, who is just a riot and sweet as pie), who was at the local shelter for a month. My parents just adore that cat, but had Willow lived in CA, she’d be dead instead of in a loving home. It can be hard to find the right home for adult cats, but she and my folks are a perfect match. It took a month to find that perfect match. Thirty days, not three.
Shame on you, Mr Schwarznegger. I hope you won’t be back.
Tags: Animal Advocacy, Cats, rescue, Schwarznegger
Posted in In The News | 2 Comments »
June 7th, 2009

It’s time for a little LINK LOVE…posted in the order I read them =)
Friends Don’t Let Friends catch (Exception) - I’m guilty of either not handling any exceptions or catching Exception when I post examples. This is why production code should NOT do what examples show. Catch what you can handle, and bubble the rest to the main handler.
Why Are You Asking Me This Question? - If you want to give the right answer, you need to get them to ask the right question.
Do you know these Excel 2007 Productivity Secrets (Hint: Coffee is not one of them) - More help with how to do things in Excel 2007. So THAT’S what those little boxes do…
Help and How to Ask For It - An interesting post from All Things Workplace, it applies to life in general as well as work
The Better You Program, The Worse You Communicate (4 reasons why) - I don’t know if I agree with this hypothesis, since I’ve met great coders who communicate well and terrible coders who communicate terribly. I DO agree that programmers should be able to communicate with the less technically savvy folks they’re writing that code FOR.
Tags: link love
Posted in Miscellaneous | No Comments »
May 19th, 2009
Sometimes SqlDataSource doesn’t work for what you want to do. It’s a great control, but as I’ve mentioned before, it can interfere with your plans because of the page lifecycle. You should also know how to run queries and get the results using the ADO.NET classes from System.Data namespace.
The following example shows you how to set up a simple ASPX page with a GridView. The GridView (bound with an easy SqlDataSource) grabs the employees from AdventureWorks. When you select a row, the manager’s details will show up in the Label controls. We make use of the DataKeyNames collection to make grabbing the ManagerID easier in the SelectedIndexChanged event. We use the ManagerID as a parameter to the query, then use SqlDataReader to read the results and populate the Label Text.
On to the code.
ASPX
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default4.aspx.vb" Inherits="Default4" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>">
<html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:SqlDataSource ID="sqldsEmployees" runat="server" ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString %>"
SelectCommand="SELECT Employee.EmployeeID, Employee.ManagerID, Employee.Title, Contact.FirstName, Contact.LastName FROM Employee INNER JOIN Contact ON Employee.ContactID = Contact.ContactID">
</asp:SqlDataSource>
<div style="z-index: 101; left: 17px; width: 370px; position: absolute; top: 83px;
height: 355px">
<asp:GridView ID="gvEmployees" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" AutoGenerateSelectButton="True" Caption="Employee List"
CellPadding="4" DataKeyNames="EmployeeID,ManagerID" DataSourceID="sqldsEmployees" ForeColor="#333333"
GridLines="None" Width="461px">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" InsertVisible="False"
ReadOnly="True" SortExpression="EmployeeID" Visible="False" />
<asp:BoundField DataField="ManagerID" HeaderText="ManagerID" SortExpression="ManagerID" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
</Columns>
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
</div>
<div style="z-index: 102; left: 502px; width: 310px; position: absolute; top: 85px;
height: 364px">
<h3>Manager Info</h3>
Title:
<asp:Label ID="lblManagerTitle" runat="server"></asp:Label><br />
Name:
<asp:Label ID="lblManagerName" runat="server"></asp:Label><br />
E-mail:
<asp:Label ID="lblManagerEmail" runat="server"></asp:Label><br />
Phone:
<asp:Label ID="lblManagerPhone" runat="server"></asp:Label></div>
</form>
</body>
</html>
Code Behind
Imports System.Collections.Specialized
Imports System.Data.Sql
Imports System.Data.SqlClient
Partial Class Default4
Inherits System.Web.UI.Page
' use the SelectedIndexChanged event, not RowCommand, because the properties for the selected row aren't populated yet in row command
Protected Sub gvEmployees_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvEmployees.SelectedIndexChanged
Dim managerID As New Integer
' we can get the manager ID because we set it in the GridView's DataKeys collection as the second one
Dim selectedManger As Object = Me.gvEmployees.SelectedDataKey.Values("ManagerID")
If Not selectedManger Is Nothing Then
managerID = CType(selectedManger, Integer)
Dim oSqlDataReader As SqlDataReader = Nothing
Try
Using oSqlConnection As New SqlConnection
oSqlConnection.ConnectionString = ConfigurationManager.ConnectionStrings("AdventureWorksConnectionString").ConnectionString
Using oSqlCommand As New SqlCommand
oSqlCommand.Connection = oSqlConnection
oSqlCommand.CommandText = "SELECT Employee.Title, Contact.FirstName, Contact.LastName, Contact.EmailAddress, Contact.Phone FROM Employee INNER JOIN Contact ON Employee.ContactID = Contact.ContactID WHERE <a href="mailto:EmployeeID=@EmployeeID">EmployeeID=@EmployeeID</a>"
oSqlCommand.CommandType = Data.CommandType.Text
oSqlCommand.Parameters.Clear()
oSqlCommand.Parameters.AddWithValue("@EmployeeID", managerID)
oSqlConnection.Open()
oSqlDataReader = oSqlCommand.ExecuteReader(Data.CommandBehavior.CloseConnection)
While oSqlDataReader.Read()
' there should only be one match
Me.lblManagerTitle.Text = oSqlDataReader("Title")
Me.lblManagerName.Text = oSqlDataReader("FirstName") & " " & oSqlDataReader("LastName")
Me.lblManagerEmail.Text = oSqlDataReader("EmailAddress")
Me.lblManagerPhone.Text = oSqlDataReader("Phone")
End While
End Using
End Using
Finally
If Not oSqlDataReader Is Nothing AndAlso Not oSqlDataReader.IsClosed Then
oSqlDataReader.Close()
End If
End Try
End If
End Sub
End Class
Did this article help you? Please share it on Digg, DZone, or your favorite social network site! As always, I appreciate comments, they let me know if people like what I’m posting. Thanks!
Tags: SqlCommand, SqlConnection, SqlDataReader, VB.NET 2.0
Posted in .NET | No Comments »