Wassup Jose Weblog nonsense at its best!

21Dec/091

Code WTF

Why use VBscript with ASP.NET? If that were not bad enough, check out the variable types. I like how the developer (I use the term very loosely) mixes Hungarian notation with Pascal Case. Also, this mess executes in the Page_Load event and is duplicated on all pages.

My favorite part is how the page communicates with the data store directly. Fat clients are here to stay. Design patterns, n-tier architectural patterns, and strong-typed languages are for losers! BTW, WordPress still cannot correctly render code snippets. Lame.

Dim UserName As String
Dim oConn As SqlConnection
Dim oCmd1 As SqlCommand
Dim oCmd2 As SqlCommand
Dim oCmd3 As SqlCommand
Dim aConfig As ConfigurationSettings
Dim strConn As String
Dim strSQL As String
Dim LastActivity As string
Dim MemberID As String = ""
Dim Inactive as Boolean

Private Sub Page_Load()
Dim dr As SqlDataReader

MemberID = Request.Cookies("Site")("MEMBERID")
strConn = ConfigurationManager.AppSettings("ConnectionString")
oConn = New SqlConnection(strConn)
Inactive = False

oConn.Open()
If trim(MemberID & "") <> "" Then
strSQL = "sp_Member @MODE='GETLASTACTIVITY',@MemberID=" & MemberID
oCmd1 = New SqlCommand(strSQL, oConn)
dr = oCmd1.ExecuteReader()
While dr.Read()
LastActivity = dr("LastActivity")
End While
dr.Close()
Inactive = DateDiff("n",LastActivity,Now()) > 30
End If
End Sub

Comments (1) Trackbacks (0)
  1. I remember writing code like this on my first programming project. I quickly learned why this mess is wrong. I would like to thank this person for increasing my value as a developer…someone’s going to have to rewrite that. :)


Leave a comment

(required)

 

No trackbacks yet.