i am tring to update the records it is not giving me any error going through the appilication but it is not updating the data base i am not able to find the problem if any one know about this then please help me
my cod eis like this:
and the store procedure is like this
my cod eis like this:
Code:
private void cmdbutton_Click(object sender, System.EventArgs e) { HtmlInputHidden objHid; HtmlInputHidden objHidden; HtmlInputRadioButton rdoButton; DataGridItem item; for (int counter = 0; counter <= this.gvEmployee.Items.Count - 1; counter++) { item = gvEmployee.Items[counter]; rdoButton = ((HtmlInputRadioButton)(item.FindControl("rdoEmployeeNominationID"))); objHidden = ((HtmlInputHidden)(item.FindControl("hidEmployeeNominationID"))); objHid = ((HtmlInputHidden)(item.FindControl("hidDatecreated"))); if (!(rdoButton == null & !(objHidden == null)& !(objHid==null))) { // if (rdoButton.Checked == true) // { // Response.Write(objHidden.Value); // Response.Write("This is the Employee Of the Month"); // return; if (rdoButton.Checked == true) { string employee=objHidden.Value; SqlConnection oConn = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["oConn"]); SqlCommand objCmd = new SqlCommand("up_updateEmployeeNominations",oConn); objCmd.CommandType = CommandType.StoredProcedure; objCmd.Parameters.Add(new SqlParameter("@employeenominationid",employee)); SqlParameter datecreated = new SqlParameter("@datecreated", SqlDbType.DateTime); datecreated.Direction = ParameterDirection.Output; objCmd.Parameters.Add(datecreated); oConn.Open(); objCmd.ExecuteNonQuery(); oConn.Close(); this.lblMassage.Text="This is Employee of the Month"; } } } }
and the store procedure is like this
Code:
CREATE PROCEDURE [dbo].[up_updateEmployeeNominations] ( @EmployeeNominationID int, @datecreated datetime output --varcahr(50) ) as update Reason set EmployeeSelected='1' from reason where reason.EmployeeNominationID=@EmployeeNominationID and reason.datecreated =@datecreated Set @datecreated =@datecreated GO
Comment