You are on page 1of 5

Practica Nº23

16 de
nov.

Practica Nº23

Programación Con Sistemas Gestores De


Bases De Datos

Ing. Sergio González Pérez

Santiago Antonio Gaytan Piña

080260173-2

5101- I

16 de Noviembre de 2010

1
Practica Nº23
16 de
nov.
Lista de Cotejo

Práctica # 23 Manejo de procedimientos

Nombre de la Materia: Plantel: Conalep Juárez I


Programación Básica
Instructor: Ing. Sergio González Pérez Grupo: 5101

Alumno: Santiago Antonio Gaytan Piña Fecha de aplicación : 16 / Noviembre / 2010

INSTRUCCIONES DE APLICACIÓN.
Verifique que se encuentren los componentes señalados abajo y marque con una √ el registro
de cumplimiento correspondiente.

DESARROLLO
REGISTRO DE

No Características a verificar CUMPLIMIENTO OBSERVACIONES


SI NO
1 Inicia el Sistema Gestor de Base de Datos ♫
2 Abre la Base de Datos que será utilizada ♫
3 Realiza los pasos de la practica ♫
4 Manipula correctamente el SGBD ♫
5 Almacena en su carpeta las actividades planteadas ♫
6 Realiza el reporte del resultado del programa. ♫

REGISTRO DE

No Actividades a desarrollar CUMPLIMIENTO OBSERVACIONES


SI NO
1 Inicializa Lenguaje de Programación ♫
2 Agrega Formulario ♫
3 Diseña los Controles del Formulario ♫
4 Realiza Código para Manejo de Precios ♫

Firma del Alumnos Firma del Instructor

2
Practica Nº23
16 de
nov.

Practica Nº23 Manejo de procedimientos

FORMULARIO

Botón Calcular
Private Sub cmdCalcular_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdCalcular.Click
txtneto.Text = Int(txthoras.Text) * Int(txtpago.Text)
txtdescuento.Text = Int(txtneto.Text) / 10
txttotal.Text = Int(txtneto.Text) - Int(txtdescuento.Text)
If Int(txttotal.Text) < 1000 Then
msg = "Deja de vegetar"
Else
msg = "TU TU MUY BIEN"
End If
MsgBox(msg, MsgBoxStyle.Information, "MENSAJE")
End Sub

Botón Guardar
Private Sub cmdGuardar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdGuardar.Click
cn.Open()
Dim GuardarDatos As String = "Insert into Salarios
(Horas,Pagoxhora,neto,Descuento,total,Mensaje)" & "Values('" &
txthoras.Text & "','" & txtpago.Text & "','" & txtneto.Text & "','" &
txtdescuento.Text & "','" & txttotal.Text & "','" & msg & "')"
Dim DataAdapter As New OleDb.OleDbDataAdapter(GuardarDatos,
cn)
DataAdapter.Fill(dt)
MsgBox("Se agrego el registro correctamente",
MsgBoxStyle.Information, "Mensaje")
DataAdapter.Dispose()
cn.Close()
End Sub

3
Practica Nº23
16 de
nov.

Botón Consultar
Private Sub cmdConsultar_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdConsultar.Click
cn.Open()
Dim ConsultarDatos As String = "select * from Salarios where
horas = " & CInt(txthoras.Text)
Dim DataAdapter As New OleDb.OleDbDataAdapter(ConsultarDatos,
cn)
DataAdapter.Fill(dt)
fila = 0
txthoras.Text = CInt(dt.Rows(fila)("Horas"))
txtpago.Text = CInt(dt.Rows(fila)("Pagoxhora"))
txtneto.Text = CInt(dt.Rows(fila)("Neto"))
txtdescuento.Text = CInt(dt.Rows(fila)("Descuento"))
txttotal.Text = CInt(dt.Rows(fila)("Total"))
MsgBox("Se Encontro el registro correctamente",
MsgBoxStyle.Information, "Mensaje")
DataAdapter.Dispose()
cn.Close()
End Sub

Botón Modificar
Private Sub cmdModificar_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdModificar.Click
cn.Open()
Dim ModificarDatos As String = "Update Salarios set Horas='" &
txthoras.Text & "', Pagoxhora='" & txtpago.Text & "' , Neto='" &
txtneto.Text & "' , Descuento='" & txtdescuento.Text & "' , Total='" &
txttotal.Text & "' , Mensaje='Modificado' where Horas = " &
CInt(txthoras.Text)
Dim dataAdapter As New OleDb.OleDbDataAdapter(ModificarDatos,
cn)
dataAdapter.Fill(dt)
txthoras.Text = CInt(dt.Rows(fila)("Horas"))
txtpago.Text = CInt(dt.Rows(fila)("Pagoxhora"))
txtneto.Text = CInt(dt.Rows(fila)("Neto"))
txtdescuento.Text = CInt(dt.Rows(fila)("Descuento"))
txttotal.Text = CInt(dt.Rows(fila)("Total"))
MsgBox("Registro Modificado Correctamente")
cn.Close()
End Sub

Botón Borrar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim BorrarDatos As String = "Delete * from Salarios Where
Horas = " & CInt(txthoras.Text)
Dim dataAdapter As New OleDb.OleDbDataAdapter(BorrarDatos, cn)
dataAdapter.Fill(dt)
refrescar()
actualizar()
MsgBox("El registro a sido eliminado satisfactoriamente")
dataAdapter.Dispose()
cn.Close()
End Sub

4
Practica Nº23
16 de
nov.

Procedimientos
Public Sub refrescar()
dt.reset()
fila = 0
Dim refrescardatos As String = "select * from Salarios"
Dim Adapter As New OleDb.OleDbDataAdapter(refrescardatos, cn)
Adapter.Fill(dt)
End Sub
Public Sub actualizar()
txtHoras.Text = CInt(dt.Rows(fila)("Horas"))
txtpago.Text = CInt(dt.Rows(fila)("PagoxHora"))
txtneto.Text = CInt(dt.Rows(fila)("Neto"))
txtDescuento.Text = CInt(dt.Rows(fila)("Descuento"))
txtTotal.Text = CInt(dt.Rows(fila)("Total"))
End Sub

Resultado

You might also like