Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 24th, 2003, 02:33 AM
Registered User
 
Join Date: Oct 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with stored procedures


This is my new scripts:

ASP PAGE

dim command
set command = Server.CreateObject("ADODB.Command")
command.ActiveConnection = conn
command.CommandText = "saldato"
command.CommandType = 4
set objParameter = command.CreateParameter ("@codcorso", 200, 1, 10, codcorso)
command.Parameters.Append objParameter
set objParameter = command.CreateParameter ("@inizio", 200, 1, 20, inizio)
command.Parameters.Append objParameter
set objParameter = command.CreateParameter ("@fine", 200, 1, 20, fine)
command.Parameters.Append objParameter
set objParameter = command.CreateParameter ("@sald", 4, 2, , 0)
command.Parameters.Append objParameter
command.Execute , , adExecuteNoRecords
saldato = command.Parameters("@sald")

'codcorso is a nvarchar
'inizio, fine are varchar
'sald is a float


STORED PROCEDURE

CREATE PROCEDURE saldato
(
   @codcorso nvarchar(10),
   @inizio varchar(20),
   @fine varchar(20),
   @sald float OUTPUT

)
 AS
SELECT SUM(dbo.Luissman_RataEdizione.importo) AS saldato, dbo.Catalogo_TBL_Edizioni.Cod_Corso, dbo.Catalogo_TBL_Corsi.Titolo
FROM dbo.Catalogo_TBL_Corsi INNER JOIN dbo.Catalogo_TBL_Edizioni ON dbo.Catalogo_TBL_Corsi.ID_Corso = dbo.Catalogo_TBL_Edizioni.ID_Corso INNER JOIN
dbo.Luissman_RataEdizione ON dbo.Catalogo_TBL_Edizioni.ID_Edizione = dbo.Luissman_RataEdizione.idedizione
WHERE (dbo.Luissman_RataEdizione.saldato = 1) AND (dbo.Luissman_RataEdizione.pagamento_data >= @inizio) AND
(dbo.Luissman_RataEdizione.pagamento_data <= @fine) AND (dbo.Luissman_RataEdizione.emissione = 1) and (dbo.Catalogo_TBL_Edizioni.Cod_Corso =@codcorso)
GROUP BY dbo.Catalogo_TBL_Edizioni.Cod_Corso, dbo.Catalogo_TBL_Corsi.Titolo
GO

The script doesn't return error but sald value is null!
WHY?

I control the execute with sql profiler and i verify that codcorso,inizio,fine values arrive in stored procedure but don't return anything.

Thank's

 
Old October 24th, 2003, 06:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

I don't know why you opened a new thread on this same subject.

As I posted in your other thread:
Quote:
quote:
4. The output parameter is never given a value in the stored proc.

5. Since your stored procedure returns a recordset, the output parameter should not be retrieved until after the recordset has been completely read.
Jeff Mason
Custom Apps, Inc.
www.custom-apps.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
stored procedures MunishBhatia SQL Server 2005 4 April 12th, 2008 01:39 AM
Stored Procedures help psnow1985 SQL Server 2005 2 April 12th, 2008 01:31 AM
Problem with tbh stored procedures! Help CRONER BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 August 4th, 2007 12:44 PM
problem with stored procedures robyd SQL Server 2000 7 October 23rd, 2003 12:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.