Click here to Skip to main content

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... PinprofessionalDuncan Edwards Jones14-Jul-14 6:43 
GeneralRe: Expression containment field... PinmemberPIEBALDconsult14-Jul-14 6:47 
GeneralRe: Expression containment field... PinprofessionalDuncan Edwards Jones14-Jul-14 7:07 
GeneralRe: Expression containment field... PinprofessionalNagy Vilmos16-Jul-14 23:43 
GeneralRe: Expression containment field... PinmemberRob Grainger20-Jul-14 23:40 
GeneralRe: Expression containment field... PinmvpDave Kreskowiak14-Jul-14 7:41 
GeneralRe: Expression containment field... Pinprotectorthatraja16-Jul-14 23:57 
GeneralWhy do I bother? PinprotectorOriginalGriff13-Jul-14 3: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? PinprotectorMarco Bertschi13-Jul-14 3:16 
GeneralRe: Why do I bother? PinprotectorOriginalGriff13-Jul-14 3:27 
GeneralRe: Why do I bother? PinprotectorMarco Bertschi13-Jul-14 3:31 
GeneralRe: Why do I bother? PinprofessionalNicholas Marty14-Jul-14 1:51 
GeneralRe: Why do I bother? PinprotectorMarco Bertschi19-Jul-14 21:31 
GeneralRe: Why do I bother? PinprofessionalNicholas Marty19-Jul-14 23:36 
JokeRe: Why do I bother? PinprofessionalKornfeld Eliyahu Peter13-Jul-14 3:57 
GeneralRe: Why do I bother? PinprotectorOriginalGriff13-Jul-14 4:42 
GeneralRe: Why do I bother? PinmemberRob Grainger14-Jul-14 6:23 
GeneralRe: Why do I bother? PinprotectorOriginalGriff14-Jul-14 6:27 
GeneralRe: Why do I bother? Pinmember Forogar 13-Jul-14 5:37 
GeneralRe: Why do I bother? PinprotectorMarco Bertschi13-Jul-14 8:05 
GeneralRe: Why do I bother? PinmemberLPartan114-Jul-14 0:48 
GeneralRe: Why do I bother? PinprofessionalKornfeld Eliyahu Peter13-Jul-14 3:58 
GeneralRe: Why do I bother? PinprofessionalJörgen Andersson13-Jul-14 5:31 
GeneralRe: Why do I bother? PinmvpDave Kreskowiak13-Jul-14 5:34 
GeneralRe: Why do I bother? PinprotectorOriginalGriff13-Jul-14 5: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
Web04 | 2.8.1411022.1 | Last Updated 22 Nov 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid