dimanche 26 mars 2017

Not able execute stored procedure from c# web api but i am able to execute from sql server is there any mistake in my code?

  this is my code 

---------------------------------------------------------------------------------enter code here try { var Result = string.Empty; DbCommand command = db.Database.Connection.CreateCommand(); command.CommandText = "Sp_InsertSetmodelparameters"; command.Parameters.Add(new SqlParameter("@FinancialYearId", Convert.ToInt32(modelinsertdata.FinancialYearId))); command.Parameters.Add(new SqlParameter("@RegionId", Convert.ToInt32(modelinsertdata.RegionId))); command.Parameters.Add(new SqlParameter("@ModelParameterFYConfigID", Convert.ToInt32(modelinsertdata.ModelParameterFYConfigID))); command.Parameters.Add(new SqlParameter("@HighPerformerProductivity", Convert.ToDecimal(inputdata.HighPerformerProductivity))); command.Parameters.Add(new SqlParameter("@MediumPerformerProductivityRatio", Convert.ToDecimal(inputdata.MediumPerformerProductivityRatio))); strong textcommand.Parameters.Add(SqlParameter("@LowPerformerProductivityRatio", Convert.ToDecimal(inputdata.LowPerformerProductivityRatio))); command.CommandType = System.Data.CommandType.StoredProcedure;

                    db.Database.Connection.Open();
                    command.ExecuteNonQuery();

                    db.Database.Connection.Close();
                    //return Ok();
                }

thanks in advance

Aucun commentaire:

Enregistrer un commentaire