Conalep 1
Programación en Sistemas Gestores de Bases de Datos
Sergio González Pérez
Rubrica 3
5101
Sarahi Vázquez W.
Imports System.Data.OleDb
Public Class Form1
Dim dt As New DataTable
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source
=E:\Cajero1.mdb")
Dim Mensaje As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim x As Integer
Dim x1 As Integer
Dim m1 As String = "El numero que capturaste es"
If (Int(txtdin.Text >= 500)) Then
x1 = 0
x = 500
txtb500.Text = txtdin.Text / 500
Else
txtb500.Text = 0
End If
If (Int(txtdin.Text <= 200)) Then
x1 = 0
x = 200
txtb200.Text = txtdin.Text / 200
Else
txtb200.Text = 0
End If
If (Int(txtdin.Text <= 100)) Then
x1 = 0
x = 100
txtb100.Text = txtdin.Text / 100
Else
txtb100.Text = 0
End If
If (Int(txtdin.Text <= 50)) Then
x1 = 0
x = 50
txtb50.Text = txtdin.Text / 50
Else
txtb50.Text = 0
End If
If (Int(txtdin.Text <= 20)) Then
x1 = 0
x = 20
txtb20.Text = txtdin.Text / 20
Else
txtb20.Text = 0
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
txtdin.Text = ""
txtb500.Text = ""
txtb200.Text = ""
txtb100.Text = ""
txtb50.Text = ""
txtb20.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
cn.Open()
Dim GuardarDatos As String = "Insert Into
Cajero1(Cantidad,B500,B200,B100,B50,B20,Mensaje)" & "values ('" & txtdin.Text &
"' , '" & txtb500.Text & "' , '" & txtb200.Text & "' , '" & txtb100.Text & "' , '" &
txtb50.Text & "' , '" & txtb20.Text & "' , " 'txtMensaje.Text & "')"
Dim dataAdapter As New OleDb.OleDbDataAdapter(GuardarDatos, cn)
dataAdapter.Fill(dt)
MsgBox("Se Agrego Registro Correctamente", MsgBoxStyle.Information,
"Mensaje")
dataAdapter.Dispose()
cn.close()
End Sub
End Class
Cajero
Cantidad B500 B200 B100 B50 B20 Mensaje
500 1 0 0 0 0
200 0 1 0 0 0
100 0 0 1 0 0
50 0 0 0 1 0
20 0 0 0 0 1