Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Code as War Crime

Code as War Crime

Scheduled Pinned Locked Moved The Weird and The Wonderful
databasedesignquestionworkspace
26 Posts 15 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gordon Kushner
    wrote on last edited by
    #1

    I haven't been on these forums in a while. But I've come across a coding atrocity so horrible, so offensive, that I have to document it. This is a Windows service. Can you see how the developer accesses database data? (Answer below)

    Dim ResultDS As New SqlDataSource

    ResultDS.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("JaguarReportingConnectionString").ToString()
    ResultDS.SelectCommand = ""

    ResultDS.[Select](DataSourceSelectArguments.Empty)

    Dim dg As New GridView
    dg.DataSource = ResultDS
    dg.DataBind()
    Dim dv As New DataView
    Dim dt As New DataTable
    dv = ResultDS.Select(DataSourceSelectArguments.Empty)
    dt = dv.ToTable()

    Hint: GridView is from the Web UI control namespace. Did I mention this is a Windows service?

    M G D V R 9 Replies Last reply
    0
    • G Gordon Kushner

      I haven't been on these forums in a while. But I've come across a coding atrocity so horrible, so offensive, that I have to document it. This is a Windows service. Can you see how the developer accesses database data? (Answer below)

      Dim ResultDS As New SqlDataSource

      ResultDS.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("JaguarReportingConnectionString").ToString()
      ResultDS.SelectCommand = ""

      ResultDS.[Select](DataSourceSelectArguments.Empty)

      Dim dg As New GridView
      dg.DataSource = ResultDS
      dg.DataBind()
      Dim dv As New DataView
      Dim dt As New DataTable
      dv = ResultDS.Select(DataSourceSelectArguments.Empty)
      dt = dv.ToTable()

      Hint: GridView is from the Web UI control namespace. Did I mention this is a Windows service?

      M Offline
      M Offline
      Marc A Brown
      wrote on last edited by
      #2

      Kill it! Kill it with fire! :)

      1 Reply Last reply
      0
      • G Gordon Kushner

        I haven't been on these forums in a while. But I've come across a coding atrocity so horrible, so offensive, that I have to document it. This is a Windows service. Can you see how the developer accesses database data? (Answer below)

        Dim ResultDS As New SqlDataSource

        ResultDS.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("JaguarReportingConnectionString").ToString()
        ResultDS.SelectCommand = ""

        ResultDS.[Select](DataSourceSelectArguments.Empty)

        Dim dg As New GridView
        dg.DataSource = ResultDS
        dg.DataBind()
        Dim dv As New DataView
        Dim dt As New DataTable
        dv = ResultDS.Select(DataSourceSelectArguments.Empty)
        dt = dv.ToTable()

        Hint: GridView is from the Web UI control namespace. Did I mention this is a Windows service?

        G Offline
        G Offline
        Gary Wheeler
        wrote on last edited by
        #3

        It could be worse. The developer could have started an instance of one of the Microsoft Office applications to do the job (in a service).

        Software Zen: delete this;

        OriginalGriffO G R 3 Replies Last reply
        0
        • G Gary Wheeler

          It could be worse. The developer could have started an instance of one of the Microsoft Office applications to do the job (in a service).

          Software Zen: delete this;

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          Yep. And for extra credit he could have used ActiveX to start it on the client! :laugh:

          The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          A 1 Reply Last reply
          0
          • G Gary Wheeler

            It could be worse. The developer could have started an instance of one of the Microsoft Office applications to do the job (in a service).

            Software Zen: delete this;

            G Offline
            G Offline
            Gordon Kushner
            wrote on last edited by
            #5

            You're creeping me out. That is exactly what he did with the DataSet!

            G 1 Reply Last reply
            0
            • G Gordon Kushner

              You're creeping me out. That is exactly what he did with the DataSet!

              G Offline
              G Offline
              Gary Wheeler
              wrote on last edited by
              #6

              "Your mission, should you choose to accept it, is to eradicate this evil from the world. As always, the Secretary will disavow any knowledge of your actions. This post will self-destruct in five seconds. Good luck, Gordon."

              Software Zen: delete this;

              P G 2 Replies Last reply
              0
              • OriginalGriffO OriginalGriff

                Yep. And for extra credit he could have used ActiveX to start it on the client! :laugh:

                The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

                A Offline
                A Offline
                Argonia
                wrote on last edited by
                #7

                Why you had to bring ActiveX into this ?

                OriginalGriffO 1 Reply Last reply
                0
                • A Argonia

                  Why you had to bring ActiveX into this ?

                  OriginalGriffO Offline
                  OriginalGriffO Offline
                  OriginalGriff
                  wrote on last edited by
                  #8

                  Because I am the AntiChrist, and it's my job to introduce Evil to the world? :laugh:

                  The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  1 Reply Last reply
                  0
                  • G Gary Wheeler

                    "Your mission, should you choose to accept it, is to eradicate this evil from the world. As always, the Secretary will disavow any knowledge of your actions. This post will self-destruct in five seconds. Good luck, Gordon."

                    Software Zen: delete this;

                    P Offline
                    P Offline
                    Phil Boyd
                    wrote on last edited by
                    #9

                    Naw - then the other developers on the team complain because that's the way they have always done it. The senior developer on the team before you doesn't want to take the time and effort to teach more junior developers better ways of doing things. So in the end - you will rip out all the code you wrote, to replace it with 5X more code/execution paths to be tested :-D

                    Phil

                    1 Reply Last reply
                    0
                    • G Gordon Kushner

                      I haven't been on these forums in a while. But I've come across a coding atrocity so horrible, so offensive, that I have to document it. This is a Windows service. Can you see how the developer accesses database data? (Answer below)

                      Dim ResultDS As New SqlDataSource

                      ResultDS.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("JaguarReportingConnectionString").ToString()
                      ResultDS.SelectCommand = ""

                      ResultDS.[Select](DataSourceSelectArguments.Empty)

                      Dim dg As New GridView
                      dg.DataSource = ResultDS
                      dg.DataBind()
                      Dim dv As New DataView
                      Dim dt As New DataTable
                      dv = ResultDS.Select(DataSourceSelectArguments.Empty)
                      dt = dv.ToTable()

                      Hint: GridView is from the Web UI control namespace. Did I mention this is a Windows service?

                      D Offline
                      D Offline
                      Diana Arnos
                      wrote on last edited by
                      #10

                      I'm just a trainee and I still have a LOT to learn (and wrote some sh*tty code myself), but even to me this looks... funny :laugh:

                      G 1 Reply Last reply
                      0
                      • D Diana Arnos

                        I'm just a trainee and I still have a LOT to learn (and wrote some sh*tty code myself), but even to me this looks... funny :laugh:

                        G Offline
                        G Offline
                        Gordon Kushner
                        wrote on last edited by
                        #11

                        Look at it hard. Study it. Do the opposite and you'll do well in your career. Best to you.

                        D 1 Reply Last reply
                        0
                        • G Gary Wheeler

                          "Your mission, should you choose to accept it, is to eradicate this evil from the world. As always, the Secretary will disavow any knowledge of your actions. This post will self-destruct in five seconds. Good luck, Gordon."

                          Software Zen: delete this;

                          G Offline
                          G Offline
                          Gordon Kushner
                          wrote on last edited by
                          #12

                          I'll assemble my elite team now! Thanks ;-)

                          1 Reply Last reply
                          0
                          • G Gordon Kushner

                            Look at it hard. Study it. Do the opposite and you'll do well in your career. Best to you.

                            D Offline
                            D Offline
                            Diana Arnos
                            wrote on last edited by
                            #13

                            Thanks! Learning what not to do is also important, that's why I always take a look around here :)

                            1 Reply Last reply
                            0
                            • G Gordon Kushner

                              I haven't been on these forums in a while. But I've come across a coding atrocity so horrible, so offensive, that I have to document it. This is a Windows service. Can you see how the developer accesses database data? (Answer below)

                              Dim ResultDS As New SqlDataSource

                              ResultDS.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("JaguarReportingConnectionString").ToString()
                              ResultDS.SelectCommand = ""

                              ResultDS.[Select](DataSourceSelectArguments.Empty)

                              Dim dg As New GridView
                              dg.DataSource = ResultDS
                              dg.DataBind()
                              Dim dv As New DataView
                              Dim dt As New DataTable
                              dv = ResultDS.Select(DataSourceSelectArguments.Empty)
                              dt = dv.ToTable()

                              Hint: GridView is from the Web UI control namespace. Did I mention this is a Windows service?

                              V Offline
                              V Offline
                              vonb
                              wrote on last edited by
                              #14

                              Wow! my boss would kill me and the code together if she sees that in production (it's a 'she' boss..)

                              1 Reply Last reply
                              0
                              • G Gordon Kushner

                                I haven't been on these forums in a while. But I've come across a coding atrocity so horrible, so offensive, that I have to document it. This is a Windows service. Can you see how the developer accesses database data? (Answer below)

                                Dim ResultDS As New SqlDataSource

                                ResultDS.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("JaguarReportingConnectionString").ToString()
                                ResultDS.SelectCommand = ""

                                ResultDS.[Select](DataSourceSelectArguments.Empty)

                                Dim dg As New GridView
                                dg.DataSource = ResultDS
                                dg.DataBind()
                                Dim dv As New DataView
                                Dim dt As New DataTable
                                dv = ResultDS.Select(DataSourceSelectArguments.Empty)
                                dt = dv.ToTable()

                                Hint: GridView is from the Web UI control namespace. Did I mention this is a Windows service?

                                R Offline
                                R Offline
                                RafagaX
                                wrote on last edited by
                                #15

                                Whoever wrote this; should be hanged, drawn and quartered...

                                CEO at: - Rafaga Systems - Para Facturas - Modern Components for the moment...

                                1 Reply Last reply
                                0
                                • G Gordon Kushner

                                  I haven't been on these forums in a while. But I've come across a coding atrocity so horrible, so offensive, that I have to document it. This is a Windows service. Can you see how the developer accesses database data? (Answer below)

                                  Dim ResultDS As New SqlDataSource

                                  ResultDS.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("JaguarReportingConnectionString").ToString()
                                  ResultDS.SelectCommand = ""

                                  ResultDS.[Select](DataSourceSelectArguments.Empty)

                                  Dim dg As New GridView
                                  dg.DataSource = ResultDS
                                  dg.DataBind()
                                  Dim dv As New DataView
                                  Dim dt As New DataTable
                                  dv = ResultDS.Select(DataSourceSelectArguments.Empty)
                                  dt = dv.ToTable()

                                  Hint: GridView is from the Web UI control namespace. Did I mention this is a Windows service?

                                  B Offline
                                  B Offline
                                  BobJanova
                                  wrote on last edited by
                                  #16

                                  Doesn't that run the query twice, too? (Once to bind it to the GridView, which I assume is the big laugh here – does that even work in a service? – and once when initialising dv.)

                                  G 1 Reply Last reply
                                  0
                                  • B BobJanova

                                    Doesn't that run the query twice, too? (Once to bind it to the GridView, which I assume is the big laugh here – does that even work in a service? – and once when initialising dv.)

                                    G Offline
                                    G Offline
                                    Gordon Kushner
                                    wrote on last edited by
                                    #17

                                    You're probably right. I was given a task to get it working again. I later learned that it may have *never* worked.

                                    1 Reply Last reply
                                    0
                                    • G Gordon Kushner

                                      I haven't been on these forums in a while. But I've come across a coding atrocity so horrible, so offensive, that I have to document it. This is a Windows service. Can you see how the developer accesses database data? (Answer below)

                                      Dim ResultDS As New SqlDataSource

                                      ResultDS.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("JaguarReportingConnectionString").ToString()
                                      ResultDS.SelectCommand = ""

                                      ResultDS.[Select](DataSourceSelectArguments.Empty)

                                      Dim dg As New GridView
                                      dg.DataSource = ResultDS
                                      dg.DataBind()
                                      Dim dv As New DataView
                                      Dim dt As New DataTable
                                      dv = ResultDS.Select(DataSourceSelectArguments.Empty)
                                      dt = dv.ToTable()

                                      Hint: GridView is from the Web UI control namespace. Did I mention this is a Windows service?

                                      C Offline
                                      C Offline
                                      Chad3F
                                      wrote on last edited by
                                      #18

                                      [Reads first line of code] Is that Visual Basic?? There's your problem right there! :laugh: Let the flame war begin (or fizzle out because nobody noticed/cared). :rose:

                                      L G 2 Replies Last reply
                                      0
                                      • C Chad3F

                                        [Reads first line of code] Is that Visual Basic?? There's your problem right there! :laugh: Let the flame war begin (or fizzle out because nobody noticed/cared). :rose:

                                        L Offline
                                        L Offline
                                        Lutoslaw
                                        wrote on last edited by
                                        #19

                                        Chad3F wrote:

                                        or fizzle out because nobody noticed/cared

                                        Now nobody will miss it. :-O

                                        Greetings - Jacek

                                        1 Reply Last reply
                                        0
                                        • G Gary Wheeler

                                          It could be worse. The developer could have started an instance of one of the Microsoft Office applications to do the job (in a service).

                                          Software Zen: delete this;

                                          R Offline
                                          R Offline
                                          Rob Grainger
                                          wrote on last edited by
                                          #20

                                          I've seen people try that - it normally fails, horribly.

                                          "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                                          G 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups