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. Database & SysAdmin
  3. Database
  4. urgent: can anyone plz tell the error in santex of SQL Query

urgent: can anyone plz tell the error in santex of SQL Query

Scheduled Pinned Locked Moved Database
databasehelp
7 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.
  • M Offline
    M Offline
    mavii
    wrote on last edited by
    #1

    i have applied the following query but in output one record appears repeatedly, can u check whether there is any error in query santax, perhaps i have used 'AND' 2 TIMES SELECT crime_mgmt.cr_location,crime_mgmt.cr_date,offensive_issue.c_desc FROM crime_mgmt,offensive_issue WHERE crime_mgmt.fir_num = offensive_issue.fir_num AND crime_mgmt.cr_date BETWEEN '" + crimewithdate.text.ToString() + "' AND '" + crimewithdate.text1.ToString() + "'ORDER BY crime_mgmt.cr_date ASC

    R I K C 4 Replies Last reply
    0
    • M mavii

      i have applied the following query but in output one record appears repeatedly, can u check whether there is any error in query santax, perhaps i have used 'AND' 2 TIMES SELECT crime_mgmt.cr_location,crime_mgmt.cr_date,offensive_issue.c_desc FROM crime_mgmt,offensive_issue WHERE crime_mgmt.fir_num = offensive_issue.fir_num AND crime_mgmt.cr_date BETWEEN '" + crimewithdate.text.ToString() + "' AND '" + crimewithdate.text1.ToString() + "'ORDER BY crime_mgmt.cr_date ASC

      R Offline
      R Offline
      Rocky
      wrote on last edited by
      #2

      SELECT crime_mgmt.cr_location,crime_mgmt.cr_date,offensive_issue.c_desc FROM crime_mgmt inner join offensive_issue on crime_mgmt.fir_num = offensive_issue.fir_num WHERE crime_mgmt.cr_date BETWEEN '" + crimewithdate.text.ToString() + "' AND '" + crimewithdate.text1.ToString() + "'ORDER BY crime_mgmt.cr_date ASC and dont forget to enclose it properly as far as thequotes are concerned. you're better off chking the value of the actual query formed while debugging.

      Rocky You can't climb up a ladder with your hands in your pockets.

      1 Reply Last reply
      0
      • M mavii

        i have applied the following query but in output one record appears repeatedly, can u check whether there is any error in query santax, perhaps i have used 'AND' 2 TIMES SELECT crime_mgmt.cr_location,crime_mgmt.cr_date,offensive_issue.c_desc FROM crime_mgmt,offensive_issue WHERE crime_mgmt.fir_num = offensive_issue.fir_num AND crime_mgmt.cr_date BETWEEN '" + crimewithdate.text.ToString() + "' AND '" + crimewithdate.text1.ToString() + "'ORDER BY crime_mgmt.cr_date ASC

        I Offline
        I Offline
        InsDev
        wrote on last edited by
        #3

        Could be possible of your date format. just try to check your input date and date store in table. Devjit Das.

        1 Reply Last reply
        0
        • M mavii

          i have applied the following query but in output one record appears repeatedly, can u check whether there is any error in query santax, perhaps i have used 'AND' 2 TIMES SELECT crime_mgmt.cr_location,crime_mgmt.cr_date,offensive_issue.c_desc FROM crime_mgmt,offensive_issue WHERE crime_mgmt.fir_num = offensive_issue.fir_num AND crime_mgmt.cr_date BETWEEN '" + crimewithdate.text.ToString() + "' AND '" + crimewithdate.text1.ToString() + "'ORDER BY crime_mgmt.cr_date ASC

          K Offline
          K Offline
          Krish KP
          wrote on last edited by
          #4

          mavii wrote:

          have applied the following query but in output one record appears repeatedly

          This can happen when there are multiple rows for same "fir_num" can you provide table structure with sample data.

          Regards KP

          1 Reply Last reply
          0
          • M mavii

            i have applied the following query but in output one record appears repeatedly, can u check whether there is any error in query santax, perhaps i have used 'AND' 2 TIMES SELECT crime_mgmt.cr_location,crime_mgmt.cr_date,offensive_issue.c_desc FROM crime_mgmt,offensive_issue WHERE crime_mgmt.fir_num = offensive_issue.fir_num AND crime_mgmt.cr_date BETWEEN '" + crimewithdate.text.ToString() + "' AND '" + crimewithdate.text1.ToString() + "'ORDER BY crime_mgmt.cr_date ASC

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #5

            Interesting, and quite disappointing, that no one picked you up on the fact that your code is susceptable to a SQL Injection attack. Please learn about SQL Injection Attacks and tips on how to prevent them[^] - most likely by following that advice you will solve other problems as well.


            Upcoming FREE developer events: * Glasgow: SQL Server Managed Objects AND Reporting Services ... My website

            P 1 Reply Last reply
            0
            • C Colin Angus Mackay

              Interesting, and quite disappointing, that no one picked you up on the fact that your code is susceptable to a SQL Injection attack. Please learn about SQL Injection Attacks and tips on how to prevent them[^] - most likely by following that advice you will solve other problems as well.


              Upcoming FREE developer events: * Glasgow: SQL Server Managed Objects AND Reporting Services ... My website

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

              Colin Angus Mackay wrote:

              Interesting, and quite disappointing, that no one picked you up on the fact that your code is susceptable to a SQL Injection attack

              I'm sorry Colin. I didn't even read his post until after I read your response. Mind you, it's interesting that the system he was working on had something to do with crime management (I'm inferring this from the table name). I would have thought that he'd want to make things as secure as possible beforehand.

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

              My blog | My articles

              C 1 Reply Last reply
              0
              • P Pete OHanlon

                Colin Angus Mackay wrote:

                Interesting, and quite disappointing, that no one picked you up on the fact that your code is susceptable to a SQL Injection attack

                I'm sorry Colin. I didn't even read his post until after I read your response. Mind you, it's interesting that the system he was working on had something to do with crime management (I'm inferring this from the table name). I would have thought that he'd want to make things as secure as possible beforehand.

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

                My blog | My articles

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #7

                Pete O`Hanlon wrote:

                I would have thought that he'd want to make things as secure as possible beforehand.

                Indeed. Unless, of course, he's in league with certain elements..... :~


                Upcoming FREE developer events: * Glasgow: SQL Server Managed Objects AND Reporting Services ... My website

                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