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. Whats wrong with this query

Whats wrong with this query

Scheduled Pinned Locked Moved Database
csharpdatabasesysadminhelpquestion
5 Posts 4 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.
  • A Offline
    A Offline
    AndreFratelli
    wrote on last edited by
    #1

    I have the following table (ccpoc)

    poc_cod varchar(10)
    poc_cod_asc varchar(10)
    poc_desc varchar(40)

    With the following data

    poc_cod poc_cod_asc poc_desc
    1 12 Coiso
    1 13 Coisa
    1 14 Coisinhas

    And I'm trying the following query UPDATE ccpoc SET poc_cod='133', poc_cod_asc='13', poc_desc='Coiso 133' WHERE poc_cod='13' AND poc_desc='Coiso 13' AND poc_cod_asc='1' I'm querying the server with an ExecuteNonQuery in C#, and everything seems to go fine. No errors, no exceptions, everything runs well. The problem is that data in the table does not change! Anybody has any idea what might be happening? Best regards

    Fratelli

    D L I 3 Replies Last reply
    0
    • A AndreFratelli

      I have the following table (ccpoc)

      poc_cod varchar(10)
      poc_cod_asc varchar(10)
      poc_desc varchar(40)

      With the following data

      poc_cod poc_cod_asc poc_desc
      1 12 Coiso
      1 13 Coisa
      1 14 Coisinhas

      And I'm trying the following query UPDATE ccpoc SET poc_cod='133', poc_cod_asc='13', poc_desc='Coiso 133' WHERE poc_cod='13' AND poc_desc='Coiso 13' AND poc_cod_asc='1' I'm querying the server with an ExecuteNonQuery in C#, and everything seems to go fine. No errors, no exceptions, everything runs well. The problem is that data in the table does not change! Anybody has any idea what might be happening? Best regards

      Fratelli

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      I guess you should give a try to these: 1. Run SQL profiler to see what query is actually run on your table. 2. Run a select statement with same where clause to check if there are any rows matching the criteria. 3. If you are using transactions, check if you have committed it or not. 4. Does the same query when run through Management studio works?

      It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

      1 Reply Last reply
      0
      • A AndreFratelli

        I have the following table (ccpoc)

        poc_cod varchar(10)
        poc_cod_asc varchar(10)
        poc_desc varchar(40)

        With the following data

        poc_cod poc_cod_asc poc_desc
        1 12 Coiso
        1 13 Coisa
        1 14 Coisinhas

        And I'm trying the following query UPDATE ccpoc SET poc_cod='133', poc_cod_asc='13', poc_desc='Coiso 133' WHERE poc_cod='13' AND poc_desc='Coiso 13' AND poc_cod_asc='1' I'm querying the server with an ExecuteNonQuery in C#, and everything seems to go fine. No errors, no exceptions, everything runs well. The problem is that data in the table does not change! Anybody has any idea what might be happening? Best regards

        Fratelli

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        AndreFratelli wrote:

        WHERE poc_cod='13' AND poc_desc='Coiso 13' AND poc_cod_asc='1'

        none of the records shown match this. :)

        Luc Pattyn


        Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


        Local announcement (Antwerp region): Lange Wapper? Neen!


        A 1 Reply Last reply
        0
        • A AndreFratelli

          I have the following table (ccpoc)

          poc_cod varchar(10)
          poc_cod_asc varchar(10)
          poc_desc varchar(40)

          With the following data

          poc_cod poc_cod_asc poc_desc
          1 12 Coiso
          1 13 Coisa
          1 14 Coisinhas

          And I'm trying the following query UPDATE ccpoc SET poc_cod='133', poc_cod_asc='13', poc_desc='Coiso 133' WHERE poc_cod='13' AND poc_desc='Coiso 13' AND poc_cod_asc='1' I'm querying the server with an ExecuteNonQuery in C#, and everything seems to go fine. No errors, no exceptions, everything runs well. The problem is that data in the table does not change! Anybody has any idea what might be happening? Best regards

          Fratelli

          I Offline
          I Offline
          i i i
          wrote on last edited by
          #4

          With the following data poc_cod poc_cod_asc poc_desc 1 12 Coiso 1 13 Coisa 1 14 Coisinhas And I'm trying the following query WHERE poc_cod='13' AND poc_desc='Coiso 13' AND poc_cod_asc='1' in your abv given data their is no row having poc_desc='Coiso 13' , so how come will it update, no doubt the results would be zero.

          Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

          1 Reply Last reply
          0
          • L Luc Pattyn

            AndreFratelli wrote:

            WHERE poc_cod='13' AND poc_desc='Coiso 13' AND poc_cod_asc='1'

            none of the records shown match this. :)

            Luc Pattyn


            Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


            Local announcement (Antwerp region): Lange Wapper? Neen!


            A Offline
            A Offline
            AndreFratelli
            wrote on last edited by
            #5

            Yes, I noticed already. Lame mistake :sigh:

            Fratelli

            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