Running a Stored Procedure

Posted on 2006-05-23
Last Modified: 2010-04-16
Hi guys,

I am after what should be a simple enough task, but baffles me...

I want to be able to run a stored procedure which is located in SQL Server 2000. I don't need any of the information returned to me, I merely need to run the procedure.

Also, I don't want to have to re-enter the username and password for the server, everytime the application is run, I want it all to be stored inside the application.

Thanks guys!
Question by:Cyber-Drugs
    LVL 25

    Accepted Solution

    to run a stored procedure:

    using(SqlConnection conn = new SqlConnection({connection string}))
        SqlCommand command = new SqlCommand("MyStoredProc",conn);

    2 options for not entering in user name:

    1) store the username and password in the connection string in the app.config file

    2) use Windows authentication
    LVL 4

    Author Comment


    Thanks for the reply, sorry, but I forgot to mention that I am using Visual Studio 2005, has the app.config been renamed, or am I just being a bit slow?

    LVL 25

    Expert Comment

    It's just not added by default.  You can add one to the project.  Also, you could open up the project Settings and add it there.
    LVL 4

    Author Comment

    Perfect, cheers! :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
    Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now