473,765 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stored Proc not Outputting

Hello,

I have a proc as displayed below. When I try to run it from ASP.NET I get an
error.

CREATE PROCEDURE [dbo].[cp_AddSession]
@SID as int,
@EID as int,
@DID as int,
@StartTime as varchar(10),
@Duration as int,
@Title as varchar(50),
@Location as varchar(50),
@Description as text,
@RegForm as varchar(50),
@SessID int OUTPUT
AS
INSERT INTO tblSessions
(intEID, intDay, strStartTime, intDuration, strTitle, strDescription,
strRoomLocation , strRegistration Form)
VALUES
(@EID, @DID, @StartTime, @Duration, @Title, @Description, @Location,
@RegForm)

SELECT @SessID = @@IDENTITY
GO
Error: Procedure 'cp_AddSession' expects parameter '@SessID', which was not
supplied.
Thanks for the help!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com


Dec 7 '05 #1
3 1133
Did you supply the parameter in your code?

"David Lozzi" <Da********@nos pam.nospam> wrote in message
news:ev******** *******@TK2MSFT NGP11.phx.gbl.. .
Hello,

I have a proc as displayed below. When I try to run it from ASP.NET I get
an error.

CREATE PROCEDURE [dbo].[cp_AddSession]
@SID as int,
@EID as int,
@DID as int,
@StartTime as varchar(10),
@Duration as int,
@Title as varchar(50),
@Location as varchar(50),
@Description as text,
@RegForm as varchar(50),
@SessID int OUTPUT
AS
INSERT INTO tblSessions
(intEID, intDay, strStartTime, intDuration, strTitle, strDescription,
strRoomLocation , strRegistration Form)
VALUES
(@EID, @DID, @StartTime, @Duration, @Title, @Description, @Location,
@RegForm)

SELECT @SessID = @@IDENTITY
GO
Error: Procedure 'cp_AddSession' expects parameter '@SessID', which was
not supplied.
Thanks for the help!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

Dec 7 '05 #2
Also, if you are only returning 1 parameters, I'd use ExecuteScalar and
simply select the value ala:

object o = command.Execute Scalar();
if (o != null && o!= DBNull.Value)
{
return Int32.Parse(o);
}

and simply do SELECT @@IDENTITY in your stored procedure.

This will return 1 value (the identity), which is exactly what ExecuteScalar
is there to handle.

On a side note, in SQL Server 2000, use SCOPE_IDENTITY( ) instead of
@@IDENTITY, else you'll eventually run into trouble:
http://weblogs.asp.net/rosherove/arc.../13/37217.aspx

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Peter Rilling" <pe***@nospam.r illing.net> wrote in message
news:eI******** ********@TK2MSF TNGP09.phx.gbl. ..
Did you supply the parameter in your code?

"David Lozzi" <Da********@nos pam.nospam> wrote in message
news:ev******** *******@TK2MSFT NGP11.phx.gbl.. .
Hello,

I have a proc as displayed below. When I try to run it from ASP.NET I get
an error.

CREATE PROCEDURE [dbo].[cp_AddSession]
@SID as int,
@EID as int,
@DID as int,
@StartTime as varchar(10),
@Duration as int,
@Title as varchar(50),
@Location as varchar(50),
@Description as text,
@RegForm as varchar(50),
@SessID int OUTPUT
AS
INSERT INTO tblSessions
(intEID, intDay, strStartTime, intDuration, strTitle, strDescription,
strRoomLocation , strRegistration Form)
VALUES
(@EID, @DID, @StartTime, @Duration, @Title, @Description, @Location,
@RegForm)

SELECT @SessID = @@IDENTITY
GO
Error: Procedure 'cp_AddSession' expects parameter '@SessID', which was
not supplied.
Thanks for the help!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com


Dec 8 '05 #3
As Peter adviced and the error says:-
Error: Procedure 'cp_AddSession' expects parameter '@SessID', which was
not supplied.
You can also look at this article by Scott here at :-
http://aspnet.4guysfromrolla.com/articles/062905-1.aspx
For a Ref
Patrick
"David Lozzi" <Da********@nos pam.nospam> wrote in message
news:ev******** *******@TK2MSFT NGP11.phx.gbl.. .
Hello,

I have a proc as displayed below. When I try to run it from ASP.NET I get an error.

CREATE PROCEDURE [dbo].[cp_AddSession]
@SID as int,
@EID as int,
@DID as int,
@StartTime as varchar(10),
@Duration as int,
@Title as varchar(50),
@Location as varchar(50),
@Description as text,
@RegForm as varchar(50),
@SessID int OUTPUT
AS
INSERT INTO tblSessions
(intEID, intDay, strStartTime, intDuration, strTitle, strDescription,
strRoomLocation , strRegistration Form)
VALUES
(@EID, @DID, @StartTime, @Duration, @Title, @Description, @Location,
@RegForm)

SELECT @SessID = @@IDENTITY
GO
Error: Procedure 'cp_AddSession' expects parameter '@SessID', which was not supplied.
Thanks for the help!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

Dec 8 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
6441
by: Wolfgang Kreuzer | last post by:
Try hard to become familiar with T-SQL. Can anybodey tell me the best way to deal with set's provided by a stored procedure. Til yesterday I thougt trapping set in temp table using INSERT EXEC is a way out of this, but then I struggeled with nested INSERT EXEC's. What are all the system proc's good for if the results cannot be evaluated? The approach of modular programming is to have code doing similar things in one place.
4
4140
by: laurenq uantrell | last post by:
I'm using the function below to output all of my stored procedures into a text file. Fice, except that the output file does not reflect the names of the stored procedures correctly if the name has been changed. For example, I create a stored procedure named: "sp123" and then rename it to "sp123DELETE" or "sp123 DELETE" or "sp123OLD" or "sp123 OLD" and what I end up with is four entries in the output file all having the stored procedure...
0
7147
by: Dave Sisk | last post by:
I've created a system or external trigger on an AS/400 file a.k.a DB2 table. (Note this is an external trigger defined with the ADDPFTRG CL command, not a SQL trigger defined with the CREATE TRIGGER statement.) I've also defined a SQL stored proc, and the trigger is set to call this SP. I've posted the simplified source below. I can manually call the stored proc, and the external trigger is created without any errors. However, when I do...
2
4280
by: Rhino | last post by:
I am getting an sqlcode of -927 when I execute SQL within a COBOL stored procedure in DB2 OS/390 Version 6 on OS/390. I have looked at the error message for that condition and tried everything I could think of to resolve the problem but nothing works. The stored proc is running in the DB2 Stored Procedures Address Space and both the client and the proc have DSNELI linked into their load modules. The client and proc are running in TSO via...
14
1834
by: Roy | last post by:
Apologies for the cross-post, but this truly is a two-sided question. Given the option of creating Looping statements within a stored proc of sql server or in the code-behind of an .net webpage, which would you choose and why? Reason I ask is I created a webpage which essentially runs through a litany of loops to determine which stored proc to kick off. This is written in the code-behind. It occurred to me that I could probably just...
4
1418
by: Jay | last post by:
In VB.NET (Studio 2005) I need to loop thru a result set returned from a stored proc and generate XML for each row. E.g. exex procWhatever returns: custno, lname, fname, address 2, Doe, John, 123 4th St. 3, Smith, Bill, 567 8th St. 4, Grant, Terry, 333 Wherever St. For each on of those rows I need to generate (string):
0
2060
by: balaji krishna | last post by:
Hi, I need to handle the return set from COBOL stored procedure from my invoking Java program. I do not know, how many rows the stored proc SQL fetches.I have declared the cursor in that proc, but i don't know how to return the rows the cursor has opened and I don't know how to handle the return set from the proc in my java code. My main problem with that proc is that whether I can retun the result set from the proc without closing the cursor...
4
1868
by: davinski | last post by:
Hello, it's been a while since my last post, hope everyone is fine :P I'm stuck with what seems to be a simple task, but I'm getting confused on how to complete this. Basically, I have been given a stored procedure which nests itself within itself and uses a temporary table to store the data while writing. The nested stored procedure is used so that it can output the data rows in a db table into an organized tree like Example 1 1.0...
0
1988
by: mirandacascade | last post by:
Questions toward the bottom of the post. Situation is this: 1) Access 97 2) SQL Server 2000 3) The Access app: a) sets up pass-thru query b) .SQL property of querydef is a string, the contents of which comprise the call to a stored proc
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8832
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5276
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.