• (nodebb)

    someone changed one of the tables to add a column to the front

    Apparently there are no longer any cardinal rules in database design.

  • (nodebb)

    14:00 UTC and there's only one comment? AND IT'S MINE? . . . is my name Beverly Crusher?

  • (nodebb)

    To what lengths won't people go to in order to make code error-prone and hard to read? It's been 25 years since Visual Studio has allowed a developer that insists on using ADO.Net directly to make a subclass of DataSet that has strongly typed tables and columns. And it has a visual designer!

  • Hey (unregistered)

    How is this a WTF exactly? An unnecessary ToString, and a repeat of the somewhat bad code? The only real thing here is using magic numbers rather than table/column callouts, really scraping the bottom of the barrel here...

  • (nodebb) in reply to dpm

    Apparently there are no longer any cardinal rules in database design.

    Yeah, first thing I thought of: Why TF would you modify a table and put a column in front of any existing columns?

    It amazes me how these people still have jobs.

  • (nodebb)

    Why TF would you modify a table and put a column in front of any existing columns?

    This is likely irrelevant (but might be). It would matter what order the columns were defined in if the data was queried with "SELECT *". However, if the query was written as "SELECT col1, col2...", then the order of definition wouldn't matter. Regardless of the likelihood of the author of this WTF also making that error, we see no evidence of it.

  • (nodebb) in reply to Jaime

    Duly noted.

    However, if the query is "SELECT * FROM", then the column was inserted at the beginning of the table, and that's wrong.

    If the query is "SELECT col1, col2 ...", then the developer inserted the new column at the beginning of the query, with no regard for how it is consumed.

    In both cases, there's a lot of WTF. One might argue it's WTWTF.

  • (nodebb) in reply to Bananafish

    Why TF would you modify a table and put a column in front of any existing columns?

    TRWTF would be relying on a specific order of the columns in a table.

  • Loren Pechtel (unregistered)

    Nitpick: Using names rather than positions has a considerable performance implication. In a case like this it won't matter (the adds to the boxes are certainly going to be even slower), but when I needed to load a whole bunch of children I got like a 3x speedup (actually higher, as my timing included the parents and some rendering) from looking up the index of the name at the start, then using the number to actually read the data.

  • (nodebb) in reply to Bananafish

    with no regard for how it is consumed.

    The code accesses columns by index. That's already a blatant disregard for how the results are consumed. ORMs are good at starting with strong typing and then figuring out a compatible query, but the only sane way to program in the modern world is to strongly type any result that come from a database with an actual schema.

    I can't tell you how many times I have to respond to "Well, the world didn't blow up when we did it thirty years ago." I constantly have to remind them that we now occupy a word where frameworks and dependencies introduce breaking changes at such an alarming rate that without several layers of defense, it will consume you.

  • (nodebb) in reply to Jaime

    I constantly have to remind them that we now occupy a word where developers who don't understand frameworks and dependencies introduce breaking changes at such an alarming rate that without several layers of defense, it will consume you.

    FTFY

  • Drak (unregistered)

    First, it looks like someone did a search-replace to add the end part to each case. Second, using a case will prevent errors if someone changes the table name, or perhaps they have an 'archive' table with the same data that can also be read by this function (still would be nice to pass the table name in, but this is probably very old. From a time where people giving asp.net courses claimed that Javascript would be gone within a few years because code-behind would do everything... yeah.. really)

    "We can see that once, this exception handler displayed a message box, but that has since been commented out, presumably because there are a lot of nulls and the number of message boxes the users had to click through were cumbersome. "

    I personally think it was a debug mechanism. And the found all the issues in the database, fixed them, and thought it would no longer be necessary.

  • (nodebb) in reply to Dragnslcr

    TRWTF would be relying on a specific order of the columns in a table.

    There are so many WTFs here it's hard to pick which is TRWTF

  • (nodebb) in reply to dpm

    is my name Beverly Crusher?

    I'm curious about this reference. Beverly Crusher was the ship's doctor on Star Trek: The Next Generation, but was she known for being the only person to leave a comment on online articles?

  • (nodebb) in reply to jkshapiro

    She was known for her "impactful comments and insightful observations", according to Google's AI. These "cementer per place as a beloved and respected character in the Star Trek universe."

    That's all I got.

    Addendum 2025-08-08 14:41: EDIT: "These cemented her place ..."

  • (nodebb)

    My guess is someone wanted a string from the various fields but Item(x) returns an object so they weren't getting intellisense, But ToString() gives the proper intellisense (though you should really cast to string... but this ia VB.NET and IIRC casts are ugly there, not that that's a reason to prefer ToString, it's a reason to prefer C#). Then with the proper intellisense they could find and use Trim().

    But then they realized they needed the text in uppercase. So they added ToUpper() but accidentally in the wrong place. But this is VB.NET which is ugly so it worked, and the dev ddin't notice.

Leave a comment on “A Dropped Down DataSet”

Log In or post as a guest

Replying to comment #:

« Return to Article