Skip to content

Instantly share code, notes, and snippets.

@jofese
Created August 2, 2017 14:53
Show Gist options
  • Save jofese/f6c5da9d0be230025cacf9bc6e84e1ab to your computer and use it in GitHub Desktop.
Save jofese/f6c5da9d0be230025cacf9bc6e84e1ab to your computer and use it in GitHub Desktop.
public Boolean Insertar(cls_Convenios_Detalle oConveniosDetalle)
{
SqlConnection _conexion = new SqlConnection(cls_Datos.cadenaconexion);
SqlCommand _comando = new SqlCommand("PA_Convenios_Detalle", _conexion) { CommandType = CommandType.StoredProcedure };
_comando.Parameters.AddWithValue("@IdConvenio", SqlDbType.VarChar).Value = oConveniosDetalle.IdConvenio;
_comando.Parameters.AddWithValue("@IdAseguradora", SqlDbType.VarChar).Value = oConveniosDetalle.IdAseguradora;
_comando.Parameters.AddWithValue("@Fecreg", SqlDbType.DateTime).Value = oConveniosDetalle.Fecreg;
_comando.Parameters.AddWithValue("@Fecmov", SqlDbType.DateTime).Value = oConveniosDetalle.Fecmov;
_comando.Parameters.AddWithValue("@Hostname", SqlDbType.VarChar).Value = oConveniosDetalle.Hostname;
_comando.Parameters.AddWithValue("@Tipo", SqlDbType.Int).Value = 2;
Boolean exito = false;
try
{
if (_conexion.State == ConnectionState.Closed)
{
_conexion.Open();
}
if (_comando.ExecuteNonQuery() > 0)
exito = true;
}
catch
{
throw;
}
finally
{
_conexion.Close();
}
return exito;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment