ASP.Net load items – an efficient way to check for isDBNull to populate a control

This was the original way to check for a database field being null before putting it into a label:

if not isDBNull(dr(“FieldName”)) then

Me.label1.text = dr(“FieldName”).ToString

else

Me.label1.text = “”

end if

however there is a much better and more efficient way….

Me.label1.text = dr.field(of String)(“FieldName”)

Sorted!

SQL Server Distinct – Make it Case Sensitive

By default SQL Server DISTINCT is NOT case sensitive. This means that if you had the following data in a table:

FirstNames
Richard
Adam
James
Adam
Ryan
RICHARD
Richard

and queried this table with “SELECT DISTINCT FirstNames FROM table” you would get:

FirstNames
Richard
Adam
James
Ryan

However, there are occasions where you want the case taken into account. Change the query to include a COLLATE function with case sensitive (notice the cs) and it then does this.

SELECT DISTINCT FirstNames COLLATE sql_latin1_general_cp1_cs_as As [FirstNames] FROM table

now returns:

FirstNames
Richard
Adam
James
Ryan
RICHARD

 

Its really handy to know and remember, especially if you are getting errors when trying to select a value from a list and the distinct name isn’t there because the exact same text is in the field with a slightly different case.

Ask a Scientist: Why Do Guys Love Women’s Butts?

chick_3642Hawaii_Frieden_Dec_2012_

The ScientistViren Swami, Ph.D., YouBeauty Attraction Expert and Reader in Psychology at the University of Westminster in London, England.

The Answer: They stare, they ogle, they pat and they pinch. But what is it that draws some men so intensely to the female behind? The long held theory that an hourglass figure, including a full lower body, is attractive because it suggests health and fertility has been largely discredited. It has yet to be replaced by a convincing alternative.

What we do know is that a booty is a uniquely female trait—and therefore uniquely feminine. After puberty, sex hormones begin to dictate the distribution of fat on the body. In men, fat accumulation is stimulated around the gut and inhibited in the seat. It’s the opposite for women, who tend to carry fat in their gluteofemoral region, that is, the butt and thighs.

That doesn’t mean that males everywhere are universally attracted to a round rump. Body weight, in general, seems to hold more sway, but preferences vary between cultures. For instance, one study suggested that while British, Spanish and Portuguese men all favored slender women, the Latin lovers were more interested in curvier bodies with bigger hips and smaller waists. Another study found that among white, British men, breast size played a large role in attraction, while butt size failed to factor in.

Indeed, if it seems like there are two types of guys—boob men and butt men—that’s because there probably are. A 2012 study in the Archives of Sexual Behavior found that Argentinian men self-reported as preferring either the breasts or the butt, but not both equally. (Consistent with the above, they leaned more toward butts.) And when the researchers tracked their eye movements as they sized up two women, their gazes systematically started and ended at their favorite part.

Read more: http://www.youbeauty.com/body-fitness/ask-a-scientist-men-and-butts#ixzz2ZPf2FbMj