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. If at first you don't succeed...

If at first you don't succeed...

Scheduled Pinned Locked Moved The Weird and The Wonderful
databasedebugginghelp
10 Posts 8 Posters 20 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.
  • S Offline
    S Offline
    sushicw
    wrote on last edited by
    #1

    While trying to debug some legacy code, I ran into this unique take on an infinite loop: ''' ''' Initializes the trouble ticket display for stations ''' Public Sub initalizeTTick(ByVal stationID As String) 'Database Dim db As New LabConsoleDB() Try Dim dr As DataRow = db.StationDetailedRecord(stationID) If dr Is Nothing Then Return 'Populate the textbox for the trouble ticket txtTTick.Text = "Location:" & vbTab & stationID("stnName").ToString().ToUpper() & vbCrLf txtTTick.Text = txtTTick.Text & "Model:" & vbTab & dr("machManuf").ToString() & " " & dr("machModel").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "Serial:" & vbTab & stationID("machSerial").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "ICN:" & vbTab & dr("machICN").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "" & vbCrLf txtTTick.Text = txtTTick.Text & "Problem:" & vbTab & vbCrLf lblStnName.Text = dr("stnName").ToString().ToUpper() 'Show the form Me.StartPosition = FormStartPosition.CenterScreen Me.Show() Catch Call initalizeTTick(stationID) End Try End Sub

    P S J S 4 Replies Last reply
    0
    • S sushicw

      While trying to debug some legacy code, I ran into this unique take on an infinite loop: ''' ''' Initializes the trouble ticket display for stations ''' Public Sub initalizeTTick(ByVal stationID As String) 'Database Dim db As New LabConsoleDB() Try Dim dr As DataRow = db.StationDetailedRecord(stationID) If dr Is Nothing Then Return 'Populate the textbox for the trouble ticket txtTTick.Text = "Location:" & vbTab & stationID("stnName").ToString().ToUpper() & vbCrLf txtTTick.Text = txtTTick.Text & "Model:" & vbTab & dr("machManuf").ToString() & " " & dr("machModel").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "Serial:" & vbTab & stationID("machSerial").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "ICN:" & vbTab & dr("machICN").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "" & vbCrLf txtTTick.Text = txtTTick.Text & "Problem:" & vbTab & vbCrLf lblStnName.Text = dr("stnName").ToString().ToUpper() 'Show the form Me.StartPosition = FormStartPosition.CenterScreen Me.Show() Catch Call initalizeTTick(stationID) End Try End Sub

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Oooh. So - if I fail, I try me again and again. Well that's nice and defensive. I assume that the user sees a MessageBox saying Time Remaining. 1 second for the next 4 hours.

      Deja View - the feeling that you've seen this post before.

      P 1 Reply Last reply
      0
      • P Pete OHanlon

        Oooh. So - if I fail, I try me again and again. Well that's nice and defensive. I assume that the user sees a MessageBox saying Time Remaining. 1 second for the next 4 hours.

        Deja View - the feeling that you've seen this post before.

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        Well, being recursive it'll blow the stack... and the catch will fire again?

        L D 2 Replies Last reply
        0
        • P PIEBALDconsult

          Well, being recursive it'll blow the stack... and the catch will fire again?

          L Offline
          L Offline
          Liam OHagan
          wrote on last edited by
          #4

          PIEBALDconsult wrote:

          and the catch will fire again

          Hehe I read that as 'will catch fire again'!

          I have no blog...

          P 1 Reply Last reply
          0
          • L Liam OHagan

            PIEBALDconsult wrote:

            and the catch will fire again

            Hehe I read that as 'will catch fire again'!

            I have no blog...

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #5

            Mmm... fire...

            1 Reply Last reply
            0
            • S sushicw

              While trying to debug some legacy code, I ran into this unique take on an infinite loop: ''' ''' Initializes the trouble ticket display for stations ''' Public Sub initalizeTTick(ByVal stationID As String) 'Database Dim db As New LabConsoleDB() Try Dim dr As DataRow = db.StationDetailedRecord(stationID) If dr Is Nothing Then Return 'Populate the textbox for the trouble ticket txtTTick.Text = "Location:" & vbTab & stationID("stnName").ToString().ToUpper() & vbCrLf txtTTick.Text = txtTTick.Text & "Model:" & vbTab & dr("machManuf").ToString() & " " & dr("machModel").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "Serial:" & vbTab & stationID("machSerial").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "ICN:" & vbTab & dr("machICN").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "" & vbCrLf txtTTick.Text = txtTTick.Text & "Problem:" & vbTab & vbCrLf lblStnName.Text = dr("stnName").ToString().ToUpper() 'Show the form Me.StartPosition = FormStartPosition.CenterScreen Me.Show() Catch Call initalizeTTick(stationID) End Try End Sub

              S Offline
              S Offline
              Steve Hansen
              wrote on last edited by
              #6

              Public Sub initalizeTTick(ByVal stationID As String)

              stationID("stnName").ToString().ToUpper()

              What the hell is that suppose to do?

              S 1 Reply Last reply
              0
              • P PIEBALDconsult

                Well, being recursive it'll blow the stack... and the catch will fire again?

                D Offline
                D Offline
                DavidNohejl
                wrote on last edited by
                #7

                Isn't StackOverflowException one of those exception that doesn't get cought in ordinary catch? edit: Indeed it is (in .NET 2.0) Clickey[^] -- modified at 6:59 Wednesday 19th September, 2007


                [My Blog]
                "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - RĂ¼diger Klaehn
                "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

                1 Reply Last reply
                0
                • S Steve Hansen

                  Public Sub initalizeTTick(ByVal stationID As String)

                  stationID("stnName").ToString().ToUpper()

                  What the hell is that suppose to do?

                  S Offline
                  S Offline
                  sushicw
                  wrote on last edited by
                  #8

                  Well, in this case, it throws a runtime error... which is caught by the exception. :) Yes, not only is the code written so that if there are errors it recurses forever, it is written in such a way that this is GUARANTEED to happen.

                  1 Reply Last reply
                  0
                  • S sushicw

                    While trying to debug some legacy code, I ran into this unique take on an infinite loop: ''' ''' Initializes the trouble ticket display for stations ''' Public Sub initalizeTTick(ByVal stationID As String) 'Database Dim db As New LabConsoleDB() Try Dim dr As DataRow = db.StationDetailedRecord(stationID) If dr Is Nothing Then Return 'Populate the textbox for the trouble ticket txtTTick.Text = "Location:" & vbTab & stationID("stnName").ToString().ToUpper() & vbCrLf txtTTick.Text = txtTTick.Text & "Model:" & vbTab & dr("machManuf").ToString() & " " & dr("machModel").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "Serial:" & vbTab & stationID("machSerial").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "ICN:" & vbTab & dr("machICN").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "" & vbCrLf txtTTick.Text = txtTTick.Text & "Problem:" & vbTab & vbCrLf lblStnName.Text = dr("stnName").ToString().ToUpper() 'Show the form Me.StartPosition = FormStartPosition.CenterScreen Me.Show() Catch Call initalizeTTick(stationID) End Try End Sub

                    J Offline
                    J Offline
                    John R Shaw
                    wrote on last edited by
                    #9

                    :laugh::laugh::laugh::laugh: Are they still employeed?

                    INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

                    1 Reply Last reply
                    0
                    • S sushicw

                      While trying to debug some legacy code, I ran into this unique take on an infinite loop: ''' ''' Initializes the trouble ticket display for stations ''' Public Sub initalizeTTick(ByVal stationID As String) 'Database Dim db As New LabConsoleDB() Try Dim dr As DataRow = db.StationDetailedRecord(stationID) If dr Is Nothing Then Return 'Populate the textbox for the trouble ticket txtTTick.Text = "Location:" & vbTab & stationID("stnName").ToString().ToUpper() & vbCrLf txtTTick.Text = txtTTick.Text & "Model:" & vbTab & dr("machManuf").ToString() & " " & dr("machModel").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "Serial:" & vbTab & stationID("machSerial").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "ICN:" & vbTab & dr("machICN").ToString() & vbCrLf txtTTick.Text = txtTTick.Text & "" & vbCrLf txtTTick.Text = txtTTick.Text & "Problem:" & vbTab & vbCrLf lblStnName.Text = dr("stnName").ToString().ToUpper() 'Show the form Me.StartPosition = FormStartPosition.CenterScreen Me.Show() Catch Call initalizeTTick(stationID) End Try End Sub

                      S Offline
                      S Offline
                      StevenWalsh
                      wrote on last edited by
                      #10

                      You might want to create a trouble ticket for that error.... but i suggest you use a different program to log it :) just in case theres a problem when you initialize it :)

                      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