Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8334835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:28:37+00:00 2026-06-09T03:28:37+00:00

I have parameters like this; comm.CommandText = usp_ProjectsCreateNew; SqlParameter param = comm.CreateParameter(); param.ParameterName =

  • 0

I have parameters like this;

    comm.CommandText = "usp_ProjectsCreateNew";

    SqlParameter param = comm.CreateParameter();
    param.ParameterName = "@ProjectId";
    param.Direction = ParameterDirection.Output;
    param.DbType = DbType.Int32;
    comm.Parameters.Add(param);

    param = comm.CreateParameter();
    param.ParameterName = "@ProjectHeading";
    param.Value = heading;
    comm.Parameters.Add(param);

    param = comm.CreateParameter();
    param.ParameterName = "@ProjectLongDescription";
    param.Value = longSummary;
    comm.Parameters.Add(param);

    param = comm.CreateParameter();
    param.ParameterName = "@ProjectUrl";
    param.Value = url;
    comm.Parameters.Add(param);

    param = comm.CreateParameter();
    param.ParameterName = "@PromoFront";
    param.Value = promoFront;
    comm.Parameters.Add(param);

    param = comm.CreateParameter();
    param.ParameterName = "@ProjectThumbnail";
    param.Value = thumbnailFileName;
    comm.Parameters.Add(param);

    param = comm.CreateParameter();
    param.ParameterName = "@ProjectImage2";
    param.Value = imageFileName1;
    comm.Parameters.Add(param);

    param = comm.CreateParameter();
    param.ParameterName = "@ProjectImage3";
    param.Value = imageFileName2;
    comm.Parameters.Add(param);

    param = comm.CreateParameter();
    param.ParameterName = "@ProjectImage4";
    param.Value = imageFileName3;
    comm.Parameters.Add(param);

    param = comm.CreateParameter();
    param.ParameterName = "@ProjectImage5";
    param.Value = imageFileName4;
    comm.Parameters.Add(param);

    comm.Transaction = tran;
    int result = comm.ExecuteNonQuery();

My stored procedure code is like this;

CREATE PROC [dbo].[usp_ProjectsCreateNew]
(
    @ProjectId INT output,
    @ProjectHeading varchar(100),
    @ProjectLongDescription varchar(max),
    @ProjectUrl varchar(100),
    @PromoFront bit,
    @ProjectThumbnail varchar(50),
    @ProjectImage2 varchar(50),
    @ProjectImage3 varchar(50),
    @ProjectImage4 varchar(50),
    @ProjectImage5 varchar(50)
)
AS
BEGIN TRY
    BEGIN TRAN
        INSERT INTO [Projects]([ProjectHeading], [ProjectLongSummary], [ProjectUrl],
            [PromoFront], [ProjectThumbnail], [ProjectImage2], [ProjectImage3], [ProjectImage4], [ProjectImage5])
        VALUES(@ProjectHeading, @ProjectLongDescription, @ProjectUrl, 
            @PromoFront, @ProjectThumbnail, @ProjectImage2, @ProjectImage3, @ProjectImage4, @ProjectImage5);

        SELECT @ProjectId = @@IDENTITY;
    COMMIT TRAN
END Try
BEGIN CATCH
    PRINT Error_Message();
    ROLLBACK TRAN
END CATCH

But I am getting this error;

Message: Procedure or function ‘usp_ProjectsCreateNew’ expects parameter ‘@ProjectId’, which was not supplied.

Source: .Net SqlClient Data Provider

Method: Void OnError(System.Data.SqlClient.SqlException, Boolean, System.Action`1[System.Action])

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:28:39+00:00Added an answer on June 9, 2026 at 3:28 am

    First of all, you’re not telling the SqlCommand that it’s a stored procedure!

    Add this line:

    comm.CommandType = CommandType.StoredProcedure;
    

    right after setting the comm‘s .CommandText property.

    Then: some of your parameters are not clear – I would recommend you use something like this for creating and adding your parameters to the SqlCommand object:

    cmd.Parameters.Add("@PromoFront", SqlDbType.Bit).Value = 1;
    

    I would always explicitly define a SqlDbType for each parameter to make it absolutely clear what it is. Not doing so could result in unwanted results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of parameters like this: public class parameter { public string
Currently i have url parameters like this http://www.website.com/index.php?user&page=edit And in index.php i have set
I have a scripts (a.py) reads in 2 parameters like this:- #!/usr/bin/env python import
I have an URL in IFRAME with parameters like this: <iframe src=http://www.example.com/id=123&place=123></iframe> Works perfectly
I have a MVC3 action method with 3 parameters like this: var url =
I have a parameter like this: rightOperand:(const NSDecimal*)rightOperand how could I provide a value
I have XML that looks like this: <Parameter Name=parameter name Value=parameter value /> which
I have passed to template dictionary parameters like parameters={ 'value':'some_value', 'style':{} } and inside
Say I have the following: [Test] // would like to parameterize the parameters in
I have a Java method that takes 3 parameters, and I'd like it to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.