I have the below stored procedure and C# code.
Stored procedure:
ALTER PROCEDURE [dbo].[ItemDetailsPicker] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; select pop.itemnmbr,cast(round(AVG(pop.unitcost),2) as decimal(10,2)) as cost from AFS.dbo.POP10110 pop where pop.REQDATE >=DateAdd(day,-14, getdate()) group by pop.itemnmbr END
C# code:
protected void BtnGetErPData_Click(object sender, EventArgs e)
{
string confirmValue = Request.Form["confirm_value"];
if (confirmValue == "Yes")
{
string afsconstring = System.Configuration.ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
using (SqlConnection con = new SqlConnection(afsconstring))
{
using (SqlCommand cmd = new SqlCommand("ItemDetailsPicker", con))
{
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
cmd.ExecuteNonQuery();
lblMessage.CssClass= "alert alert-success";
lblMessage.Text = "Msg 23: Data updated successfully";
txtItemNumber.Text = "";
txtCost.Text = "";
txtDescription.Text = "";
}
}
}
else
{
lblMessage.CssClass = "alert alert-warning";
lblMessage.Text = "Msg 23: something went wrong. Please try again";
}
}The code returns
Msg 23: Data updated successfully
But the data is not populated in the IC_Item_M table.
Regards,
Deepak