Exforsys

Online Training

How to retrive values from Stored procedures in .net?

This is a discussion on How to retrive values from Stored procedures in .net? within the SQL Server 2005 Tutorials forums, part of the Articles and Tutorials category; Hello anyone, Can anyone tell me how to retrive the values from "Stored Procedures" using .net. I know ...


Go Back   Exforsys > Articles and Tutorials > SQL Server 2005 Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-31-2006, 10:30 PM
svs_aditya's Avatar
Aditya
 
Join Date: Jul 2006
Location: India
Posts: 11
svs_aditya is on a distinguished road
Send a message via Yahoo to svs_aditya
Question How to retrive values from Stored procedures in .net?

Hello anyone,
Can anyone tell me how to retrive the values from "Stored Procedures" using .net.
I know oneway is using " Out parameters".
can anyone suggest the other?????
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-01-2006, 05:38 AM
Senior Member
 
Join Date: Mar 2005
Posts: 909
techguru is on a distinguished road
I would use sqldatareader.. so you can loop throug..
there is no need to define any out parameters in the procedure..

create procedure

in parameters

select * from table


retruns all the records you need as datareader which you can loop through...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-01-2006, 01:01 PM
svs_aditya's Avatar
Aditya
 
Join Date: Jul 2006
Location: India
Posts: 11
svs_aditya is on a distinguished road
Send a message via Yahoo to svs_aditya
Thanks

hai, thanks for giving one solution.

but my real problem is:
1.if we return any value in stored procedure using "return"(keyword) statement then how catch the return value in C#
2. simillar the above how fetch the returnerror message in C#
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-16-2007, 03:51 AM
DataBase Lover
 
Join Date: Oct 2007
Posts: 3
a.karrabi is on a distinguished road
Exclamation hi

if u use sqlcommand for executing stored procedure by wizard, return value stored in sqlcommand.parameter(0).value after sqlcommand.executeScalar().
if you write the code by yourself, you must add a parameter as RETURN type in add parameter list.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new questions
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Problem with stored procedure NareshShroff SQL Server 2005 Tutorials 1 07-06-2007 03:16 AM
.NET Certification List lokeshm MicroSoft Certification 1 06-02-2006 05:21 AM
Microsoft .NET : An Introduction to the .NET FCL, Part 5 techguru Microsoft .NET Tutorials and Articles 0 08-29-2005 02:25 PM
Visual Basic : Security Concerns for Visual Basic .NET and Visual C# .NET Programmers techguru Visual Basic Tutorials 0 08-29-2005 12:27 AM
Free VB .NET Std Ed. and ASP.NET Develop. Book sanereddy Microsoft .NET Tutorials and Articles 0 10-05-2004 12:59 PM


All times are GMT -4. The time now is 07:12 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.