471,066 Members | 1,567 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,066 software developers and data experts.

Getting Data for a stored procedure

jed
I have created a stored procedure in SQLExpress management.I need to
retrieve a numeric value that the stored procedure creates and use it
in a C# application.Please help thanks.
USE [biking checks]
GO
/****** Object: StoredProcedure [dbo].[Getlastodo] Script Date:
03/19/2007 00:54:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Getlastodo]

AS
BEGIN

SELECT MAX(Totaldistance) AS lastodo
FROM bik

END
need to retrieve the lastodo value

Mar 19 '07 #1
2 1378
Look into using the SqlCommand class and the ExecuteScalar method.

--
Carsten Thomsen
Senior .NET Solutions Architect / Developer / Author
MCAD/MCSD/MCSE/MCTS
<je*@auto-soft.co.zawrote in message
news:11*********************@b75g2000hsg.googlegro ups.com...
>I have created a stored procedure in SQLExpress management.I need to
retrieve a numeric value that the stored procedure creates and use it
in a C# application.Please help thanks.
USE [biking checks]
GO
/****** Object: StoredProcedure [dbo].[Getlastodo] Script Date:
03/19/2007 00:54:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Getlastodo]

AS
BEGIN

SELECT MAX(Totaldistance) AS lastodo
FROM bik

END
need to retrieve the lastodo value

Mar 19 '07 #2
je*@auto-soft.co.za wrote:
I have created a stored procedure in SQLExpress management.I need to
retrieve a numeric value that the stored procedure creates and use it
in a C# application.Please help thanks.
USE [biking checks]
GO
/****** Object: StoredProcedure [dbo].[Getlastodo] Script Date:
03/19/2007 00:54:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Getlastodo]

AS
BEGIN

SELECT MAX(Totaldistance) AS lastodo
FROM bik

END
need to retrieve the lastodo value
You execute the stored procedure and you get a DataReader which
you read just as if it were a SELECT you had executed.

Arne
Mar 19 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Wojciech Wendrychowicz | last post: by
4 posts views Thread by Mike Dinnis | last post: by
2 posts views Thread by Andrew Cooper | last post: by
reply views Thread by leo001 | last post: by

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.