21st Century Meltdown

IIf(Format(Now(),"yyyy") + 0 > Format([sol_date_reqd],"yyyy") + 0,-1,IIf(Format(Now(),"yyyy") + 0 < Format([sol_date_reqd],"yyyy") + 0,IIf(Format([SOL_DATE_REQD],"ww",1,1) + 0 > IIf(Format(Now(),"ww",1,1) + 10 > 52,Format(Now(),"ww",1,1) - 42,Format(Now(),"ww",1,1) + 10),IIf(Format(Now(),"ww",1,1) + 10 > 52,Format(Now(),"ww",1,1) - 42,Format(Now(),"ww",1,1) + 10),Format([SOL_DATE_REQD],"ww",1,1) + 0),IIf(Format([sol_date_reqd],"ww",1,1) + 0 < Format(Now(),"ww",1,1) + 0,-1,IIf(Format([sol_date_reqd],"ww",1,1) + 0 > Format(Now(),"ww",1,1) + 10,Format(Now(),"ww",1,1) + 10,IIf(Format([sol_date_reqd],"ww",1,1) + 0 > 52,1,Format([sol_date_reqd],"ww",1,1) + 0)))))

That’s all one line save for the formatting of this page.. Anybody who can work out what it does gets a cookie.

And here’s a novel way of getting a row count -

static int GetTableRowCount(string tableName)
 {
 int count = 0;
 SqlCommand cmd = new SqlCommand();
 cmd.Connection = getConn();
 cmd.CommandText = "SELECT * FROM [" + tableName + "]";
 SqlDataReader dr = cmd.ExecuteReader();
 while (dr.Read()) { count += 1; }
 return count;
 }

(SELECT Count(*) is too easy I suppose..)

The Daily WTF