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

  • Home
  • SEARCH
  • 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 8112655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:34:31+00:00 2026-06-06T02:34:31+00:00

I have an SQL procedure with these parameters @WorkflowApprovalHistoryId int OUTPUT, @ProjectUid uniqueidentifier, @ProjectId

  • 0

I have an SQL procedure with these parameters

@WorkflowApprovalHistoryId      int                 OUTPUT,
    @ProjectUid                     uniqueidentifier,
    @ProjectId                      nvarchar(50),
    @StageUid                       uniqueidentifier,
    @Username                       nvarchar(50),
    @WasRejected                    bit,
    @Cost                           money,
    @Work                           money,
    @StartDate                      datetime,
    @FinishDate                     datetime,
    @InsertDate                     datetime            OUTPUT

I have checked this Failed To Convert Parameter Value From A String To A Int32 , but it does not helped me because i dont have any input parameter as int.

I am Pasting my code here

private void LogApproval(Guid prjUId, bool wasRejected) {
            string projectId = string.Empty;
            Nullable<Guid> stageUid = null;
            Nullable<decimal> cost = null;
            Nullable<decimal> work = null;
            Nullable<DateTime> startDate = null;
            Nullable<DateTime> finishDate = null;
            string stageGuid = string.Empty;
            //Processing here
            SqlConnection conn = null;
            conn = new SqlConnection(getConnectionString());
            conn.Open();
            SqlCommand cmnd=new SqlCommand();
            cmnd.CommandText="ProcedureName";
            cmnd.CommandType=CommandType.StoredProcedure;
            cmnd.Connection=conn;
            SqlParameter param1=new SqlParameter();
            param1=cmnd.Parameters.Add("@WorkflowApprovalHistoryId",SqlDbType.Int);
            param1.Direction=ParameterDirection.ReturnValue;

            SqlParameter param2=new SqlParameter();
            param2=cmnd.Parameters.Add("@ProjectUid",SqlDbType.UniqueIdentifier);//sharepoint
            param2.Direction=ParameterDirection.Input;
            param2.Value = System.Data.SqlTypes.SqlGuid.Parse(prjUId.ToString());
            //param2.Value=prjUId;
            SqlParameter param3=new SqlParameter();
            param3=cmnd.Parameters.Add("@ProjectId",SqlDbType.NVarChar);
            param3.Direction=ParameterDirection.Input;
            param3.Value=projectId;
            SqlParameter param4=new SqlParameter();
            param4=cmnd.Parameters.Add("@StageUid",SqlDbType.UniqueIdentifier);// PSI
            param4.Direction=ParameterDirection.Input;
            param4.Value = System.Data.SqlTypes.SqlGuid.Parse(stageUid.ToString());
            //param4.Value=stageUid;
            SqlParameter param5=new SqlParameter();
            param5=cmnd.Parameters.Add("@Username",SqlDbType.NVarChar); //unidentified
            param5.Direction=ParameterDirection.Input;
            param1.Value="userName";
            SqlParameter param6=new SqlParameter();
            param6=cmnd.Parameters.Add("@WasRejected",SqlDbType.Bit);//form status provide as input
            param6.Direction=ParameterDirection.Input;
            if (wasRejected == true)
                param6.Value = 1;
            else
                param6.Value = 0;
            SqlParameter param7=new SqlParameter();
            param7=cmnd.Parameters.Add("@Cost",SqlDbType.Money); //PSI
            param7.Direction=ParameterDirection.Input;
            param7.Value=cost;
            SqlParameter param8=new SqlParameter();
            param8=cmnd.Parameters.Add("@Work",SqlDbType.Money);//PSI
            param8.Direction=ParameterDirection.Input;
            param8.Value=work;
            SqlParameter param9=new SqlParameter();
            param9=cmnd.Parameters.Add("@StartDate",SqlDbType.DateTime);// PSI
            param9.Direction=ParameterDirection.Input;
            param9.Value=startDate;
            SqlParameter param10=new SqlParameter();
            param10=cmnd.Parameters.Add("@FinishDate",SqlDbType.DateTime);// PSI
            param10.Direction=ParameterDirection.Input;
            param10.Value=finishDate;


            SqlParameter param11=new SqlParameter();
            param11=cmnd.Parameters.Add("@InsertDate",SqlDbType.DateTime);
            param11.Direction = ParameterDirection.ReturnValue;

            cmnd.ExecuteNonQuery();
            var HistoryID = param1.Value;
            var InsertDate = param11.Value;
}

on executing Execute NonQuery it throws Failed to convert parameter value from a String to a Int32

  • 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-06T02:34:33+00:00Added an answer on June 6, 2026 at 2:34 am

    The output parameters should be not ParameterDirection.Output, not ParameterDirection.ReturnValue.

    ParameterDirection.ReturnValue is for the integer result value of a stored procedure produced by a SQL return statement

    Incidentally, Parameters.AddWithValue is recommended over Parameters.Add for input values

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

Sidebar

Related Questions

I have an SQL query that takes these parameters: @SearchFor nvarchar(200) = null ,@SearchInLat
I have sql server procedure, please see below. ALTER PROCEDURE [dbo].[uspInsertDelegate] ( @CourseID int,
I have a SQL procedure that generates a util file as its output depending
I have a T-SQL stored procedure with the signature CREATE PROCEDURE MyProc @recordCount INT
SQL Server 2005. I have a stored procedure which accepts a few parameters that
I have a PL/SQL procedure with multiple parameters. When a webapp calls the procedure,
I have a stored procedure in SQL Server 2005 which accepts few parameters of
There are databases on Firebird and SQL Server. I have working stored procedure in
I have an SQL CREATE PROCEDURE statement that runs perfectly in my local SQL
I have a SQL Server stored procedure that is not returning any data when

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.