Note that there are some explanatory texts on larger screens.

plurals
  1. POFailed to convert parameter value from a String to a Int32 while executing stored procedure
    primarykey
    data
    text
    <p>I have an SQL procedure with these parameters</p> <pre><code>@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 </code></pre> <p>I have checked this <a href="https://stackoverflow.com/questions/10675857/failed-to-convert-parameter-value-from-a-string-to-a-int32">Failed To Convert Parameter Value From A String To A Int32</a> , but it does not helped me because i dont have any input parameter as int.</p> <p>I am Pasting my code here</p> <pre><code>private void LogApproval(Guid prjUId, bool wasRejected) { string projectId = string.Empty; Nullable&lt;Guid&gt; stageUid = null; Nullable&lt;decimal&gt; cost = null; Nullable&lt;decimal&gt; work = null; Nullable&lt;DateTime&gt; startDate = null; Nullable&lt;DateTime&gt; 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; } </code></pre> <p>on executing Execute NonQuery it throws Failed to convert parameter value from a String to a Int32</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload