passing through more than one parameter to a stored procedure.

Posted on 2007-07-27
Last Modified: 2010-04-15
how do you accept multiple stored procedure parameters at the same time? I have the following code:

SqlParameter myParm1 = myCmd.Parameters.Add("@Parameter1", System.Data.SqlDbType.VarChar, 20);
myParm1.Value = "string";

I want to be able to pass more than one value through to the stored procedure
Question by:mitesh114
    LVL 96

    Expert Comment

    by:Bob Learned
    What version of .NET are you using?

    2005 has this form:
        myCmd.Parameters.AddWithValue("@Parameter1", "string");


    Author Comment

    i'm not using that version. I'm using the previous one.
    LVL 20

    Expert Comment

    myCmd.Parameters.Add("@Parameter1", "string");

    LVL 20

    Accepted Solution

    myCmd.Parameters.Add("@Parameter1", "string");

    myCmd.Parameters.Add("@Parameter2", "string");

    myCmd.Parameters.Add("@Parameter3", "string");

    myCmd.Parameters.Add("@Parameter4", "string");


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    728 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

    20 Experts available now in Live!

    Get 1:1 Help Now