ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Laboratorio de base de datos


Enviado por   •  22 de Junio de 2017  •  Informes  •  2.085 Palabras (9 Páginas)  •  219 Visitas

Página 1 de 9

Integrantes:

Nombre de la Carpeta: Problema1_Proyecto2

Ruta de la Base de Datos:  VisualStudio\2015\Projects\Problema1_Proyecto2\Problema1_Proyecto2\fut

Versión de Visual Studio: 2015

  1. Interface Grafica

[pic 1]

[pic 2]

[pic 3]

  1. Código Fuente

Form1

Public Class Form1

    Dim table As DataTable

    Dim Obj As New CRUD

    Public n As Integer

    Private Sub caso(equipo As String, Res As Integer, gol As Integer, gol2 As Integer)

        If String.Compare(equipo, "Niupi") = 0 Then

            n = 0

        End If

        If String.Compare(equipo, "Los nappas") = 0 Then

            n = 1

        End If

        If String.Compare(equipo, "Javiersin") = 0 Then

            n = 2

        End If

        If String.Compare(equipo, "Pepe") = 0 Then

            n = 3

        End If

        If String.Compare(equipo, "La bomba") = 0 Then

            n = 4

        End If

        If String.Compare(equipo, "Manecitas") = 0 Then

            n = 5

        End If

        If String.Compare(equipo, "Casio") = 0 Then

            n = 6

        End If

        If String.Compare(equipo, "Lobato") = 0 Then

            n = 7

        End If

        If String.Compare(equipo, "El flujo FC") = 0 Then

            n = 8

        End If

        If String.Compare(equipo, "Kotowa") = 0 Then

            n = 9

        End If

        If String.Compare(equipo, "Jardineros") = 0 Then

            n = 10

        End If

        If String.Compare(equipo, "Otros") = 0 Then

            n = 11

        End If

        DataGridView2.Rows(n).Cells(2).Value = 1 + DataGridView2.Rows(n).Cells(2).Value

        DataGridView2.Rows(n).Cells(6).Value = gol + DataGridView2.Rows(n).Cells(6).Value

        DataGridView2.Rows(n).Cells(7).Value = gol2 + DataGridView2.Rows(n).Cells(7).Value

        If Res = 1 Then

            DataGridView2.Rows(n).Cells(3).Value = 1 + DataGridView2.Rows(n).Cells(3).Value

            DataGridView2.Rows(n).Cells(8).Value = 2 + DataGridView2.Rows(n).Cells(8).Value

        End If

        If Res = 2 Then

            DataGridView2.Rows(n).Cells(5).Value = 1 + DataGridView2.Rows(n).Cells(5).Value

        End If

        If Res = 3 Then

            DataGridView2.Rows(n).Cells(4).Value = 1 + DataGridView2.Rows(n).Cells(4).Value

            DataGridView2.Rows(n).Cells(8).Value = 1 + DataGridView2.Rows(n).Cells(8).Value

        End If

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        'TODO: esta línea de código carga datos en la tabla 'FutbolDataSet.Equipo' Puede moverla o quitarla según sea necesario.

        Me.EquipoTableAdapter.Fill(Me.FutbolDataSet.Equipo)

        Obj.conexion()

        Dim Sql As String = "Select * from Equipo"

        Obj.consulta(DataGridView2, Sql)

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim Resultado As Integer

        Dim Resultado2 As Integer

        Dim eq As String

        Dim eq2 As String

        eq = ComboBox1.SelectedItem.ToString

        eq2 = ComboBox2.SelectedItem.ToString

        If String.Compare(eq, eq2) = 0 Then

            MsgBox("Partido Invalido")

        Else

            If (CInt(TextBox1.Text) > CInt(TextBox2.Text)) Then

                Resultado = 1

                Resultado2 = 2

            End If

            If (CInt(TextBox1.Text) < CInt(TextBox2.Text)) Then

                Resultado = 2

                Resultado2 = 1

            End If

            If (CInt(TextBox1.Text) = CInt(TextBox2.Text)) Then

                Resultado = 3

                Resultado2 = 3

            End If

            caso(eq, Resultado, CInt(TextBox1.Text), CInt(TextBox2.Text))

            caso(eq2, Resultado2, CInt(TextBox2.Text), CInt(TextBox1.Text))

        End If

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        For a As Integer = 0 To 11

            'Dim Sql As String = "Insert Into Equipo (Jugados, Ganados, Empatados, Perdidos, GA, GC, Puntos) Select " & DataGridView2.Rows(a).Cells(2).Value & ", '" & DataGridView2.Rows(a).Cells(3).Value & "', '" & DataGridView2.Rows(a).Cells(4).Value & "', '" & DataGridView2.Rows(a).Cells(5).Value & "', '" & DataGridView2.Rows(a).Cells(6).Value & "', '" & DataGridView2.Rows(a).Cells(7).Value & "', '" & DataGridView2.Rows(a).Cells(8).Value & "'"

            Dim Sql As String = "Update Equipo Set Jugados='" & DataGridView2.Rows(a).Cells(2).Value & "', Ganados='" & DataGridView2.Rows(a).Cells(3).Value & "',Empatados ='" & DataGridView2.Rows(a).Cells(4).Value & "',Perdidos ='" & DataGridView2.Rows(a).Cells(5).Value & "' ,GA ='" & DataGridView2.Rows(a).Cells(6).Value & "',GC ='" & DataGridView2.Rows(a).Cells(7).Value & "' ,Puntos ='" & DataGridView2.Rows(a).Cells(8).Value & "' where Id=" & a + 1 & ""

...

Descargar como (para miembros actualizados)  txt (8.8 Kb)   pdf (481.5 Kb)   docx (993.9 Kb)  
Leer 8 páginas más »
Disponible sólo en Clubensayos.com