


public void pulsandoActualizar(object sender, DataGridCommandEventArgs e)
{
String strcn = ConfigurationSettings.AppSettings["conectando"];
SqlConnection conexion = new SqlConnection(strcn);
conexion.Open();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();
txtnombrelibro = ((TextBox)e.Item.Cells[1].Controls[0]).Text;
vaciardatos = "Update Insmattxt Set NombreLibro ='"+ txtnombrelibro +"' Where idmat ='"+DataGridMat.DataKeys[(int)e.Item.ItemIndex]+"'";
SqlCommand ejecutar = new SqlCommand(vaciardatos, conexion);
ejecutar.ExecuteNonQuery();
DataGridMat.EditItemIndex = -1;
DataGridMat.SelectedIndex = -1;
sql = "j_PartidaLibroMat";
da.SelectCommand = new SqlCommand(sql, conexion);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add("@varpro", SqlDbType.Int, 4);
da.SelectCommand.Parameters["@varpro"].Value = Convert.ToInt32(Request.QueryString["id"]);
da.SelectCommand.Parameters.Add("@varorc", SqlDbType.NVarChar, 255);
da.SelectCommand.Parameters["@varorc"].Value = Convert.ToString(Request.QueryString["id1"]);
da.SelectCommand.Parameters.Add("@varcateg", SqlDbType.Int, 4);
da.SelectCommand.Parameters["@varcateg"].Value = Convert.ToInt32(Request.QueryString["id2"]);
da.SelectCommand.Parameters.Add("@varlibro", SqlDbType.NVarChar, 255);
da.SelectCommand.Parameters["@varlibro"].Value = Convert.ToString(Request.QueryString["id3"]);
da.SelectCommand.Parameters.Add("@varpartida", SqlDbType.Int, 4);
da.SelectCommand.Parameters["@varpartida"].Value = Convert.ToInt32(Request.QueryString["id4"]);
da.Fill(ds, "partidamat");
DataGridMat.DataSource = ds.Tables["partidamat"].DefaultView;
DataGridMat.DataBind();
conexion.Close();
}
Gracias de antemano...