Imp

download Imp

If you can't read please download the document

description

c# code

Transcript of Imp

protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { GridView1.EditIndex = e.NewEditIndex; display(); } protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { String constr = ConfigurationManager.ConnectionStrings["DatabaseConnectionString1"].ToString(); SqlConnection con = new SqlConnection(constr); con.Open(); SqlCommand cmd = new SqlCommand("Update ITEMS SET ITEM_NAME = @ITEM_NAME,ITEM_CODE = @ITEM_CODE Where ITEM_ID = @ITEM_ID", con); cmd.ExecuteNonQuery(); con.Close(); GridView1.EditIndex = -1; display(); } protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { GridView1.EditIndex = -1; display(); } protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { String constr = ConfigurationManager.ConnectionStrings["DatabaseConnectionString1"].ToString(); SqlConnection con = new SqlConnection(constr); con.Open(); SqlCommand cmd = new SqlCommand("Delete ITEMS Where ITEM_ID = @ITEM_ID", con); int result = cmd.ExecuteNonQuery(); con.Close(); display(); }