Copi de seguridad de base de datos
Publicado por Ignacio (15 intervenciones) el 17/12/2005 18:06:05
Estoy haciendo un programa para un colegio y necesitaria hacer copia de seguridad de la base de datos. En realidad el problema es que para copiar la base de datos primero debo cerrar la conexion con la misma, al hacerlo la copio sin problemas pero al querer abrirla nuevamente no me deja. La conexion la realicé con el data environment de visual.
Private Sub Form_Load()
frmPrincipal.CerrarTablas 'Cierro las tablas
DE.cn.Close ' Cierro conexion
End Sub
Private Sub Form_Unload(Cancel As Integer)
DE.cn.Open ' problema
frmPrincipal.AbrirTablas ' Error
End Sub
Public Sub AbrirTablas()
If DE.rsPersona.State = 0 Then
DE.rsPersona.Open
End If
If DE.rsAlumnos.State = 0 Then
DE.rsAlumnos.Open
End If
If DE.rsTutores.State = 0 Then
DE.rsTutores.Open
End If
If DE.rsGrupo.State = 0 Then
DE.rsGrupo.Open
End If
If DE.rsMatricula.State = 0 Then
DE.rsMatricula.Open
End If
If DE.rsCuotas.State = 0 Then
DE.rsCuotas.Open
End If
If DE.rsCalificaciones.State = 0 Then
DE.rsCalificaciones.Open
End If
If DE.rsMaterias.State = 0 Then
DE.rsMaterias.Open
End If
If DE.rsCursa.State = 0 Then
DE.rsCursa.Open
End If
If DE.rsAmonestaciones.State = 0 Then
DE.rsAmonestaciones.Open
End If
If DE.rsAsistenciaProfesor.State = 0 Then
DE.rsAsistenciaProfesor.Open
End If
If DE.rsDiaProfesor.State = 0 Then
DE.rsDiaProfesor.Open
End If
If DE.rsDicta.State = 0 Then
DE.rsDicta.Open
End If
If DE.rsDistribucionHoraria.State = 0 Then
DE.rsDistribucionHoraria.Open
End If
If DE.rsInasistencias.State = 0 Then
DE.rsInasistencias.Open
End If
If DE.rsLegajoAdministrativo.State = 0 Then
DE.rsLegajoAdministrativo.Open
End If
If DE.rsLibros.State = 0 Then
DE.rsLibros.Open
End If
If DE.rsPrestamos.State = 0 Then
DE.rsPrestamos.Open
End If
If DE.rsProfesores.State = 0 Then
DE.rsProfesores.Open
End If
If DE.rsTitulos.State = 0 Then
DE.rsTitulos.Open
End If
If DE.rsModulos.State = 0 Then
DE.rsModulos.Open
End If
If DE.rsUsuarios.State = 0 Then
DE.rsUsuarios.Open
End If
End Sub
Public Sub CerrarTablas()
If DE.rsPersona.State = 1 Then
DE.rsPersona.Close
End If
If DE.rsAlumnos.State = 1 Then
DE.rsAlumnos.Close
End If
If DE.rsTutores.State = 1 Then
DE.rsTutores.Close
End If
If DE.rsGrupo.State = 1 Then
DE.rsGrupo.Close
End If
If DE.rsMatricula.State = 1 Then
DE.rsMatricula.Close
End If
If DE.rsCuotas.State = 1 Then
DE.rsCuotas.Close
End If
If DE.rsCalificaciones.State = 1 Then
DE.rsCalificaciones.Close
End If
If DE.rsMaterias.State = 1 Then
DE.rsMaterias.Close
End If
If DE.rsCursa.State = 1 Then
DE.rsCursa.Close
End If
If DE.rsAmonestaciones.State = 1 Then
DE.rsAmonestaciones.Close
End If
If DE.rsAsistenciaProfesor.State = 1 Then
DE.rsAsistenciaProfesor.Close
End If
If DE.rsDiaProfesor.State = 1 Then
DE.rsDiaProfesor.Close
End If
If DE.rsDicta.State = 1 Then
DE.rsDicta.Close
End If
If DE.rsDistribucionHoraria.State = 1 Then
DE.rsDistribucionHoraria.Close
End If
If DE.rsInasistencias.State = 1 Then
DE.rsInasistencias.Close
End If
If DE.rsLegajoAdministrativo.State = 1 Then
DE.rsLegajoAdministrativo.Close
End If
If DE.rsLibros.State = 1 Then
DE.rsLibros.Close
End If
If DE.rsPrestamos.State = 1 Then
DE.rsPrestamos.Close
End If
If DE.rsProfesores.State = 1 Then
DE.rsProfesores.Close
End If
If DE.rsTitulos.State = 1 Then
DE.rsTitulos.Close
End If
If DE.rsModulos.State = 1 Then
DE.rsModulos.Close
End If
If DE.rsUsuarios.State = 1 Then
DE.rsUsuarios.Close
End If
End Sub
Private Sub Form_Load()
frmPrincipal.CerrarTablas 'Cierro las tablas
DE.cn.Close ' Cierro conexion
End Sub
Private Sub Form_Unload(Cancel As Integer)
DE.cn.Open ' problema
frmPrincipal.AbrirTablas ' Error
End Sub
Public Sub AbrirTablas()
If DE.rsPersona.State = 0 Then
DE.rsPersona.Open
End If
If DE.rsAlumnos.State = 0 Then
DE.rsAlumnos.Open
End If
If DE.rsTutores.State = 0 Then
DE.rsTutores.Open
End If
If DE.rsGrupo.State = 0 Then
DE.rsGrupo.Open
End If
If DE.rsMatricula.State = 0 Then
DE.rsMatricula.Open
End If
If DE.rsCuotas.State = 0 Then
DE.rsCuotas.Open
End If
If DE.rsCalificaciones.State = 0 Then
DE.rsCalificaciones.Open
End If
If DE.rsMaterias.State = 0 Then
DE.rsMaterias.Open
End If
If DE.rsCursa.State = 0 Then
DE.rsCursa.Open
End If
If DE.rsAmonestaciones.State = 0 Then
DE.rsAmonestaciones.Open
End If
If DE.rsAsistenciaProfesor.State = 0 Then
DE.rsAsistenciaProfesor.Open
End If
If DE.rsDiaProfesor.State = 0 Then
DE.rsDiaProfesor.Open
End If
If DE.rsDicta.State = 0 Then
DE.rsDicta.Open
End If
If DE.rsDistribucionHoraria.State = 0 Then
DE.rsDistribucionHoraria.Open
End If
If DE.rsInasistencias.State = 0 Then
DE.rsInasistencias.Open
End If
If DE.rsLegajoAdministrativo.State = 0 Then
DE.rsLegajoAdministrativo.Open
End If
If DE.rsLibros.State = 0 Then
DE.rsLibros.Open
End If
If DE.rsPrestamos.State = 0 Then
DE.rsPrestamos.Open
End If
If DE.rsProfesores.State = 0 Then
DE.rsProfesores.Open
End If
If DE.rsTitulos.State = 0 Then
DE.rsTitulos.Open
End If
If DE.rsModulos.State = 0 Then
DE.rsModulos.Open
End If
If DE.rsUsuarios.State = 0 Then
DE.rsUsuarios.Open
End If
End Sub
Public Sub CerrarTablas()
If DE.rsPersona.State = 1 Then
DE.rsPersona.Close
End If
If DE.rsAlumnos.State = 1 Then
DE.rsAlumnos.Close
End If
If DE.rsTutores.State = 1 Then
DE.rsTutores.Close
End If
If DE.rsGrupo.State = 1 Then
DE.rsGrupo.Close
End If
If DE.rsMatricula.State = 1 Then
DE.rsMatricula.Close
End If
If DE.rsCuotas.State = 1 Then
DE.rsCuotas.Close
End If
If DE.rsCalificaciones.State = 1 Then
DE.rsCalificaciones.Close
End If
If DE.rsMaterias.State = 1 Then
DE.rsMaterias.Close
End If
If DE.rsCursa.State = 1 Then
DE.rsCursa.Close
End If
If DE.rsAmonestaciones.State = 1 Then
DE.rsAmonestaciones.Close
End If
If DE.rsAsistenciaProfesor.State = 1 Then
DE.rsAsistenciaProfesor.Close
End If
If DE.rsDiaProfesor.State = 1 Then
DE.rsDiaProfesor.Close
End If
If DE.rsDicta.State = 1 Then
DE.rsDicta.Close
End If
If DE.rsDistribucionHoraria.State = 1 Then
DE.rsDistribucionHoraria.Close
End If
If DE.rsInasistencias.State = 1 Then
DE.rsInasistencias.Close
End If
If DE.rsLegajoAdministrativo.State = 1 Then
DE.rsLegajoAdministrativo.Close
End If
If DE.rsLibros.State = 1 Then
DE.rsLibros.Close
End If
If DE.rsPrestamos.State = 1 Then
DE.rsPrestamos.Close
End If
If DE.rsProfesores.State = 1 Then
DE.rsProfesores.Close
End If
If DE.rsTitulos.State = 1 Then
DE.rsTitulos.Close
End If
If DE.rsModulos.State = 1 Then
DE.rsModulos.Close
End If
If DE.rsUsuarios.State = 1 Then
DE.rsUsuarios.Close
End If
End Sub
Valora esta pregunta


0