Click here to Skip to main content
11,578,241 members (61,373 online)

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrasing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralExpression containment field... Pin
Duncan Edwards Jones14-Jul-14 5:43
professionalDuncan Edwards Jones14-Jul-14 5:43 
GeneralRe: Expression containment field... Pin
PIEBALDconsult14-Jul-14 5:47
memberPIEBALDconsult14-Jul-14 5:47 
GeneralRe: Expression containment field... Pin
Duncan Edwards Jones14-Jul-14 6:07
professionalDuncan Edwards Jones14-Jul-14 6:07 
GeneralRe: Expression containment field... Pin
Nagy Vilmos16-Jul-14 22:43
professionalNagy Vilmos16-Jul-14 22:43 
GeneralRe: Expression containment field... Pin
Rob Grainger20-Jul-14 22:40
memberRob Grainger20-Jul-14 22:40 
GeneralRe: Expression containment field... Pin
Dave Kreskowiak14-Jul-14 6:41
mvpDave Kreskowiak14-Jul-14 6:41 
GeneralRe: Expression containment field... Pin
thatraja16-Jul-14 22:57
protectorthatraja16-Jul-14 22:57 
GeneralWhy do I bother? Pin
OriginalGriff13-Jul-14 2:07
protectorOriginalGriff13-Jul-14 2:07 
A question this morning, and as part of explaining what was causing the problem he had noticed, I suggested that this code:
string checkuser = " select count(*) from UserDetail where UserName='" + TextBoxUN + "'";
Wasn't going to work, because it would be the same as writing:
string checkuser = " select count(*) from UserDetail where UserName='System.Web.UI.WebControls.TextBox'";
And he should use TextBoxUN.Text instead, but that it was dangerous because of SQL Injection.
Unrelated to the problem he had noticed, but going to be a problem soon.

So...fast forward a couple of hours, and the same user has a new problem: his code doesn't find his username:
string checkuser = " select count(*) from UserDetail where UserName='System.Web.UI.WebControls.TextBox'";
SqlCommand com = new SqlCommand(checkuser, conn);

*BANG*desk*BANG*desk*BANG*
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

GeneralRe: Why do I bother? Pin
Marco Bertschi13-Jul-14 2:16
protectorMarco Bertschi13-Jul-14 2:16 
GeneralRe: Why do I bother? Pin
OriginalGriff13-Jul-14 2:27
protectorOriginalGriff13-Jul-14 2:27 
GeneralRe: Why do I bother? Pin
Marco Bertschi13-Jul-14 2:31
protectorMarco Bertschi13-Jul-14 2:31 
GeneralRe: Why do I bother? Pin
Nicholas Marty14-Jul-14 0:51
professionalNicholas Marty14-Jul-14 0:51 
GeneralRe: Why do I bother? Pin
Marco Bertschi19-Jul-14 20:31
protectorMarco Bertschi19-Jul-14 20:31 
GeneralRe: Why do I bother? Pin
Nicholas Marty19-Jul-14 22:36
professionalNicholas Marty19-Jul-14 22:36 
JokeRe: Why do I bother? Pin
Kornfeld Eliyahu Peter13-Jul-14 2:57
professionalKornfeld Eliyahu Peter13-Jul-14 2:57 
GeneralRe: Why do I bother? Pin
OriginalGriff13-Jul-14 3:42
protectorOriginalGriff13-Jul-14 3:42 
GeneralRe: Why do I bother? Pin
Rob Grainger14-Jul-14 5:23
memberRob Grainger14-Jul-14 5:23 
GeneralRe: Why do I bother? Pin
OriginalGriff14-Jul-14 5:27
protectorOriginalGriff14-Jul-14 5:27 
GeneralRe: Why do I bother? Pin
Forogar 13-Jul-14 4:37
member Forogar 13-Jul-14 4:37 
GeneralRe: Why do I bother? Pin
Marco Bertschi13-Jul-14 7:05
protectorMarco Bertschi13-Jul-14 7:05 
GeneralRe: Why do I bother? Pin
LPartan113-Jul-14 23:48
memberLPartan113-Jul-14 23:48 
GeneralRe: Why do I bother? Pin
Kornfeld Eliyahu Peter13-Jul-14 2:58
professionalKornfeld Eliyahu Peter13-Jul-14 2:58 
GeneralRe: Why do I bother? Pin
Jörgen Andersson13-Jul-14 4:31
professionalJörgen Andersson13-Jul-14 4:31 
GeneralRe: Why do I bother? Pin
Dave Kreskowiak13-Jul-14 4:34
mvpDave Kreskowiak13-Jul-14 4:34 
GeneralRe: Why do I bother? Pin
OriginalGriff13-Jul-14 4:52
protectorOriginalGriff13-Jul-14 4:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 5 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid