using C# class to call stored procedure RRS feed

  • Question

  • Hi All,

    I am new to C# coding. I learnt stored procedure basics. I wrote a simple stored procedure to insert data into sql server. I tested the stored procedure and it was executed fine.

    Now I have designed a user interface page to enter the same data. I want to use this stored procedure to insert the data into sql server.

    I want to create class and call this class from my code behind file(.cs) .

    I need some guidance in doing so. Can anyone just help me to get started with.

    Your help is appreciated.

    Thanks in Advance,


    Thursday, August 30, 2012 3:26 PM


All replies

  • Hi M_Saleem,

    Welcome to MSDN Forum.

    Please refer here. This document introduces how to call a parameterized stored procedure in ado.net. If you need any further help, please feel free to let me know. : )

    Best Regards

    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by M_Saleem Friday, August 31, 2012 6:25 AM
    Friday, August 31, 2012 2:20 AM
  • Hi Saleem,

    Why don't you use sqlhelper.cs in http://www.koders.com/csharp/fidD4121D6E4BCA2DAB656D770903FECBFF7427D242.aspx Just add it to your project as a class and you can call it's methods and so on from your cs files.


    Friday, August 31, 2012 3:44 AM
  • HI All,

    Thanks for the replies that you both have made. The links provided by you people were helpful and in some way i would be benefited and i hope i ll be able to follow the docs and  i ll try to leran the concepts and methods used. 

    Thanks agian for providing some light on this. 



    Friday, August 31, 2012 6:25 AM
  • Hi Saleem,

    There are many versions of SQhelper.cs, there are some which is easier use.  Just google it, and you'll se lots of samples.


    Friday, August 31, 2012 7:55 AM
  • Hi Jason,

    Thanks for your reply. I will definitely have a search on it. But i want to use my own code as it will help me to learn more and I would be getting more knowledge in writing code.

    Thanks !!! :-),


    Friday, August 31, 2012 4:02 PM