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. General Programming
  3. C#
  4. Query takes a long time and then crashes............???

Query takes a long time and then crashes............???

Scheduled Pinned Locked Moved C#
databasecsharpasp-netsysadminhelp
22 Posts 6 Posters 0 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.
  • R Reality Strikes

    I'm working on an ASP.Net application accessing couple of database tables from AS400 mainframe server database. In the code there's an SQL Query, which seems very complicated to me, the person who did the actual coding is no more with our firm. Right now the query is producing some kinda result which is wrong. So can anyone please help me out in finding what's wrong with the SQL query? The SQL query is attached below:

    Me.OdbcSelectCommand2.CommandText = "SELECT SAMFILE.STAYP.SCLINT, SAMFILE.STAYP.SADMHH, SAMFILE.STAYP.SADMYY, SAMFILE.STAYP.SADMMM, SAMFILE.STAYP.SBLDG, SAMFILE.STAYP.SADMDD, SAMFILE.STAYP.STRMCD, SAMFILE.STAYP.STRMHH, SAMFILE.STAYP.STRMYY, SAMFILE.STAYP.STRMMM, SAMFILE.STAYP.STRMDD, SAMFILE.CLIENTP.CNAME, SAMFILE.CLIENTP.CRACE1, SAMFILE.CLIENTP.CRACE2, SAMFILE.CLIENTP.CRELIG, SAMFILE.CLIENTP.CSEX, SAMFILE.CLIENTP.CBTHHH, SAMFILE.CLIENTP.CBTHYY, SAMFILE.CLIENTP.CBTHMM, SAMFILE.CLIENTP.CBTHDD, SAMFILE.REFSRP.REFSDS, SAMFILE.STAYP.SMDPM, SAMFILE.STAYP.SREFRL, SAMFILE.STAYP.SADRG1, SAMFILE.STAYP.SADRG2, SAMFILE.RACETP.RACEDS, SAMFILE.RELIGP.RELGDS, SAMFILE.STAYP.SADMAG FROM SAMFILE.REFSRP, SAMFILE.RELIGP, SAMFILE.RACETP, { oj SAMFILE.STAYP LEFT OUTER "JOIN SAMFILE.CLIENTP ON SAMFILE.STAYP.SCLINT = SAMFILE.CLIENTP.""CLNT#""} WHERE SAMFILE.REFSRP.REFSCD = SAMFILE.STAYP.SREFRL AND SAMFILE.RELIGP.RELGCD = SAMFILE.CLIENTP.CRELIG AND SAMFILE.RACETP.RACECD = SAMFILE.CLIENTP.CRACE1" // After some loop conditions, the OdbcSelectCommand2 is used in 4 concatenations like this. OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " AND (({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT(digits(SADMHH), digits(SADMYY)) }, '-') }, digits(SADMMM)) }, '-') }, digits(SADMDD)) } <= { d '" & End_date_conv & "' })"OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " AND ({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT(digits(STRMHH), digits(STRMYY)) }, '-') }, digits(STRMMM)) }, '-') }, digits(STRMDD)) } >= { d '" & Start_date_conv & "' })"OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " OR ({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT(digits(SADMHH), digits(SADMYY)) }, '-') }, digits(SADMMM)) }, '-') }, digits(SADMDD)) } <= { d '" & End_date_conv & "' })"OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " AND (SAMFILE.STAYP.STRMCD = 0))" // To get the desired result, one more table is suppossed to be u

    A Offline
    A Offline
    Ashfield
    wrote on last edited by
    #8

    Have you tried getting a wrking query directly against the database without involving odbc? When it works there inclue it in your asp page.

    Bob Ashfield Consultants Ltd

    R 1 Reply Last reply
    0
    • R Reality Strikes

      without the last piece of code [SAMFILE.MOVESP.MCODE = A] also, this query works but it gives an incorrect result. and the only code which can fetch the true values wud be if we include the MCODE code.

      L Offline
      L Offline
      Le centriste
      wrote on last edited by
      #9

      I think your problem is outside the scope of this forum, and maybe of any forum here.

      1 Reply Last reply
      0
      • A Ashfield

        Have you tried getting a wrking query directly against the database without involving odbc? When it works there inclue it in your asp page.

        Bob Ashfield Consultants Ltd

        R Offline
        R Offline
        Reality Strikes
        wrote on last edited by
        #10

        as mentioned, the database is on AS/400 Mainframe server. without odbc how can i chk the query. can u guide me on how to proceed with this?

        L A 2 Replies Last reply
        0
        • R Reality Strikes

          look dear, if u can put in some valuable comments, pls go ahead, otherwise dont try to rule anybody, u get tht.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #11

          fuck off asshole

          led mike

          R 1 Reply Last reply
          0
          • L led mike

            fuck off asshole

            led mike

            R Offline
            R Offline
            Reality Strikes
            wrote on last edited by
            #12

            Please stop it.

            modified on Tuesday, December 9, 2008 3:36 PM

            L 1 Reply Last reply
            0
            • R Reality Strikes

              Please stop it.

              modified on Tuesday, December 9, 2008 3:36 PM

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #13

              Nice job changing that old post I linked to. Still I saw it so, fuck off asshole.

              led mike

              R 1 Reply Last reply
              0
              • L led mike

                Nice job changing that old post I linked to. Still I saw it so, fuck off asshole.

                led mike

                R Offline
                R Offline
                Reality Strikes
                wrote on last edited by
                #14

                very bad Led......i'm surprised who ur employer is...........

                L 1 Reply Last reply
                0
                • R Reality Strikes

                  very bad Led......i'm surprised who ur employer is...........

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #15

                  Perhaps, however

                  Reality Strikes wrote:

                  please have basic manners

                  you proved you are a giant hypocritical turd with that post given your reply to Graus which you have now deleted in an attempt to hide the truth thereby also proving you are without honor and integrity. So for the last time (today), fuck off asshole.

                  led mike

                  R 1 Reply Last reply
                  0
                  • L led mike

                    Perhaps, however

                    Reality Strikes wrote:

                    please have basic manners

                    you proved you are a giant hypocritical turd with that post given your reply to Graus which you have now deleted in an attempt to hide the truth thereby also proving you are without honor and integrity. So for the last time (today), fuck off asshole.

                    led mike

                    R Offline
                    R Offline
                    Reality Strikes
                    wrote on last edited by
                    #16

                    i dont know wht the heck u r blabbering..........take a day off from u work and relax.........u will feel better........!!!

                    led mike wrote:

                    So for the last time (today), f*** off a**hole.

                    why making it the last time, say it over and over..........coz thts wht ur parents taught u..........say it very proudly.........!!!

                    L 1 Reply Last reply
                    0
                    • R Reality Strikes

                      i dont know wht the heck u r blabbering..........take a day off from u work and relax.........u will feel better........!!!

                      led mike wrote:

                      So for the last time (today), f*** off a**hole.

                      why making it the last time, say it over and over..........coz thts wht ur parents taught u..........say it very proudly.........!!!

                      L Offline
                      L Offline
                      led mike
                      wrote on last edited by
                      #17

                      Reality Strikes wrote:

                      i dont know wht the heck u r blabbering

                      Good, now we can add "lying sack of shit" to your description.

                      led mike

                      R 1 Reply Last reply
                      0
                      • L led mike

                        Reality Strikes wrote:

                        i dont know wht the heck u r blabbering

                        Good, now we can add "lying sack of shit" to your description.

                        led mike

                        R Offline
                        R Offline
                        Reality Strikes
                        wrote on last edited by
                        #18

                        didnt u see tht icon next to ur name..........seems u r in deep s*** man.........!!! u r crude uncouth ill-bred person lacking culture or refinement and we prefer calling thm as BARBARIANS.

                        J 1 Reply Last reply
                        0
                        • R Reality Strikes

                          as mentioned, the database is on AS/400 Mainframe server. without odbc how can i chk the query. can u guide me on how to proceed with this?

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

                          I feel really sorry for your employer, letting you lose with such equipment...

                          xacc.ide - now with TabsToSpaces support
                          IronScheme - 1.0 beta 1 - out now!
                          ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))

                          1 Reply Last reply
                          0
                          • R Reality Strikes

                            didnt u see tht icon next to ur name..........seems u r in deep s*** man.........!!! u r crude uncouth ill-bred person lacking culture or refinement and we prefer calling thm as BARBARIANS.

                            J Offline
                            J Offline
                            J4amieC
                            wrote on last edited by
                            #20

                            plz dnt us txtspk in da 4rm.

                            1 Reply Last reply
                            0
                            • R Reality Strikes

                              as mentioned, the database is on AS/400 Mainframe server. without odbc how can i chk the query. can u guide me on how to proceed with this?

                              A Offline
                              A Offline
                              Ashfield
                              wrote on last edited by
                              #21

                              I have no idea about as400 database utilities, but every database I have ever come across has some utility to allow you to run queries. I suggest you speak to one of your colleagues and find out how to do it.

                              Bob Ashfield Consultants Ltd

                              R 1 Reply Last reply
                              0
                              • A Ashfield

                                I have no idea about as400 database utilities, but every database I have ever come across has some utility to allow you to run queries. I suggest you speak to one of your colleagues and find out how to do it.

                                Bob Ashfield Consultants Ltd

                                R Offline
                                R Offline
                                Reality Strikes
                                wrote on last edited by
                                #22

                                Thanks Bob.

                                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