ExecuteNonQuery return -1

From my vb net application I call a stored procedure in a Pervasive database. This is the st.proc.
CREATE PROCEDURE "spUpdateAllineaPos18" (in :AllineaPos18 utinyint,
in :Descrizione varchar(50));

BEGIN
      UPDATE AnaAllineaPos18
      SET Descrizione = :Descrizione
      WHERE AllineaPos18 = :AllineaPos18;
END;

To call it I use a PSqlCommand. What is strange is that if I call ExecuteNonQuery the method always return -1 but the stored was executed exactly. Why?
fantamenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
that is normal, because that procedure does not return any records, ie it does not run a UPDATE, INSERT, DELETE statement directly.
calling a stored procedure will hence return -1. it's not 100% clear in the docs, though:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery.aspx

if you want the number of rows affected, you have to "return" that in a output parameter, for example.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fantamenAuthor Commented:
Dear angellll I've modified my stored procedure:
CREATE PROCEDURE "spUpdateAllineaPos18" (in :AllineaPos18 utinyint,
in :Descrizione varchar(50), out :RecUpd integer);

BEGIN
      UPDATE AnaAllineaPos18
      SET Descrizione = :Descrizione
      WHERE AllineaPos18 = :AllineaPos18;
      SET :RecUpd = @@ROWCOUNT;
END;

In vb code I read the output parameter RecUpd and it look to work correctly. What do you think?
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>SET :RecUpd = @@ROWCOUNT;
yes, that is exactly the most performant method, AFAIK.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.