Re: Can someone explain why my code is not working



jbonifacejr wrote:
Sorry if this angers anyone. I'm posting here and to the .NET group.

No anger here, It's just that you are not likely to get .Net assistance by
posting to a class ADO group Also, multiposting is definitely frowned upon.
See this thread:
http://groups.google.com/group/microsoft.public.inetserver.asp.db/browse_thread/thread/12b527322a3ad4df/9caef09e60b05718?hl=en#9caef09e60b05718

I
am unable to get a return value from a stored procedure in .NET using
the following Sproc and .NET code


In this case however, the answer is the same for both ADO.Net and classic
ADO: Add "SET NOCOUNT ON to the body of your procedure, as shown below.

The reason for this is that SQL Server returns informational "x rows
affected" messages (the ones you see when executing your procedure in Query
Analyzer) as resultsets. These resultsets need to be "consumed" by the
client BEFORE the ouput parameter value is sent. Setting NOCOUNT on
suppresses these messages.

I am a little curious why you are using classic ADO (ADODB) in your .Net
application vs. the native ADO.Net libraries. But you should discuss this in
the .Net group you posted to.


Here is the code in my stored proc.

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sprocRetArtistSerial]
-- Add the parameters for the stored procedure here
@sArtist varchar(50),
@sRetArtist bigint OUTPUT
AS
BEGIN
SET NOCOUNT ON
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


.



Relevant Pages

  • Re: SET NOCOUNT ON
    ... this means less clutter in the results pane; in ADO it can ... I use SET NOCOUNT ON in every single stored procedure I write. ...
    (microsoft.public.sqlserver.programming)
  • Re: SQL Server stored prcedures with output parameters
    ... the stored procedure below appears to consistently ... > moment) how ADO handles that. ... Parameter 1 had direction input ... Appending parameter value http://www.holdenweb.com/ ...
    (comp.lang.python)
  • Re: Stored Procedure is running slow!
    ... > I run stored procedure from QA, it takes some 15 seconds to execute. ... > seconds when called from MS Fox Pro, via ADO. ... Try this in Query Analyzer: ... By default Query Analyzer runs with ARITHABORT ON, ...
    (microsoft.public.sqlserver.programming)
  • Re: Very bad response time from stored procedure call via ADO
    ... We have a stored procedure that returns some statistical information ... SQL Server is version 2000 ... When run in SQL Query Analyser the typical duration is 400ms. ... When run from the VB6 application via ADO the duration increases to ...
    (microsoft.public.data.ado)
  • Re: Stored procedure functionality and visibility questions
    ... I have the impression that most of the time it's best to use DAO or ADO ... >>>but I also keep reading about additional stored procedure support that was ... I've looked into using a VBA function or procedure to perform the task ... >> application automate Access. ...
    (microsoft.public.access.modulesdaovba)