Reply to post: Re: Bad code? Don't talk to me about bad code...

You've seen things people wouldn't believe – so tell us your programming horrors

mhoulden
Boffin

Re: Bad code? Don't talk to me about bad code...

Some code I've seen does similar:

1. Get current date in US format (MM/DD/YYYY HH:MM:SS)

2. Insert record using that date (as a string) as the last modified date

3. Use that date to determine which record was inserted and get the primary key

I'm in the UK so it tends to go funny after the 12th of the month, and this is a complex web app that can have lots of people using it at once, so two people inserting records at exactly the same time is unlikely but not impossible. It would be so much easier if the person who originally wrote it knew about SELECT @@IDENTITY (it's on SQL Server), but I think that's one of the reasons he was invited to take his services elsewhere.

Don't get me started on the section of code that was written in Classic ASP by a team that didn't bother with Option Explicit and liked global variables with names like zotz...

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon