Exforsys
+ Reply to Thread
Results 1 to 4 of 4

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 forums, part of the Database category; Hello anyone, Can anyone tell me how to retrive the values from "Stored Procedures" using .net. I know oneway is ...

  1. #1
    svs_aditya's Avatar
    svs_aditya is offline Aditya Array
    Join Date
    Jul 2006
    Location
    India
    Answers
    10

    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?????


  2. #2
    techguru is offline Senior Member Array
    Join Date
    Mar 2005
    Answers
    112
    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...


  3. #3
    svs_aditya's Avatar
    svs_aditya is offline Aditya Array
    Join Date
    Jul 2006
    Location
    India
    Answers
    10

    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#


  4. #4
    a.karrabi is offline DataBase Lover Array
    Join Date
    Oct 2007
    Answers
    3

    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.


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...