//METODO BUSCAR public DataTable Buscar(DacfRVAt_registrovaluacion acfRVAt_registrovaluacion) { DataTable DtResultado = new DataTable("acfRVAt_registrovaluacion"); SqlConnection SqlCon = new SqlConnection(); try { SqlCon.ConnectionString = DConexion.CnBDActivo; SqlCommand SqlCmd = new SqlCommand(); SqlCmd.Connection = SqlCon; SqlCmd.CommandText = "usp_B_acfRVAt_registrovaluacion"; SqlCmd.CommandType = CommandType.StoredProcedure; SqlParameter ParRVAresponsable = new SqlParameter(); ParRVAresponsable.ParameterName = "@sRVAresponsable"; ParRVAresponsable.SqlDbType = SqlDbType.Char; ParRVAresponsable.Size = 50; ParRVAresponsable.Value = acfRVAt_registrovaluacion.RVAresponsable; SqlCmd.Parameters.Add(ParRVAresponsable); SqlDataAdapter SqlDat = new SqlDataAdapter(SqlCmd); SqlDat.Fill(DtResultado); } catch (Exception ex) { DtResultado = null; } return(DtResultado); }
//METODO ELIMINAR public string Eliminar(DacfRVAt_registrovaluacion acfRVAt_registrovaluacion) { string rpta = ""; SqlConnection SqlCon = new SqlConnection(); try { //Código SqlCon.ConnectionString = DConexion.CnBDActivo; SqlCon.Open(); //Establecer el Comando SqlCommand SqlCmd = new SqlCommand(); SqlCmd.Connection = SqlCon; SqlCmd.CommandText = "usp_D_acfRVAt_registrovaluacion"; SqlCmd.CommandType = CommandType.StoredProcedure; SqlParameter ParRVAcodigo = new SqlParameter(); ParRVAcodigo.ParameterName = "@sRVAcodigo"; ParRVAcodigo.SqlDbType = SqlDbType.Char; ParRVAcodigo.Value = acfRVAt_registrovaluacion.RVAcodigo; SqlCmd.Parameters.Add(ParRVAcodigo); // //Ejecutamos nuestro comando rpta = SqlCmd.ExecuteNonQuery() != 0 ? "OK" : "NO se Elimino el Registro"; } catch (Exception ex) { rpta = ex.Message; } finally { if (SqlCon.State == ConnectionState.Open) { SqlCon.Close(); } } return(rpta); }