- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsHe there:
I have a stored procedure that has some input parameters and some output parameters. The input parameters are supposed to be drawn from two user controls (hiddenfields) and one is supposed to be taken from the querystring. The output parameters are supposed to be viewed in the detailsview that displays my data.
However I have no luck doing this. It seems as if I cannot display the output parameters as rows in my gridview, and it seems I have to give my output parameters a value before the stored procedure is executed - which is pointless, because this is not relevant.
Any ideas?
The stored procedure looks like this:
ALTER PROCEDURE dbo.ejNotifiedTilmeldinger
@antal int OUTPUT,
@not_notified bit output,
@dato varchar(30),
@kursus_id int,
@profil_id int
AS
declare @antal2 int
SET @antal=0
set @antal2=0
set @not_notified='false'
select @antal = count(*)
from kursusTilmelding
WHERE kursusTilmelding.dato = @dato
AND kursusTilmelding.kursus_id
AND kursusTilmelding.profil_id
AND kursusTilmelding.slettet = 'false'
and kursusTilmelding.notified = 'false'
select @antal2 = count(*)
FROM undertilmeldingNy
WHERE undertilmeldingNy.dato = @dato
AND undertilmeldingNy.kursus_i
AND undertilmeldingNy.slettet = 'false'
AND undertilmeldingNy.betaling
and undertilmeldingNy.notified
set @antal=@antal+@antal2
if @antal>0 set @not_notified='true'
RETURN @antal
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: jnhorstPosted on 2006-10-20 at 14:53:54ID: 17777569
The problem is probably that when you construct your SqlCommand, the output params are not identfied as such in the Direction property. If you are using VS2003, try this:
Open the Server Explorer and create a connection to your database. Show your stored procedures and then drag the one you want to use onto your web page when it is in design mode. You should see an icon appear in the component tray below the page in design view. This represents a SqlCommand object, the code for which has been written by the IDE in the "Web Form Designer generated code" section of your code page.
You can right click this icon and select Properties. Inspect the Parameters collection and you will see that your output params have been declare as such.
Set the input params in code, ExecuteNonQuery() against the command, and then get the values from the output parameters.
John