Whats wrong with this query
-
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 CoisinhasAnd 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 regardsFratelli
-
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 CoisinhasAnd 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 regardsFratelli
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
-
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 CoisinhasAnd 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 regardsFratelli
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!
-
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 CoisinhasAnd 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 regardsFratelli
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
-
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!
Yes, I noticed already. Lame mistake :sigh:
Fratelli