La pobreza en guatemala
Para poder utilizar este programa se debe realizar una Query (Consulta) teniendo en cuenta que la BD ya esta realizada.
Luego se debe establecer una conexión de Visual y SQL.
Código de Conexión:
Imports System.Data.SqlClient
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadDim bd As New SqlConnection("Server= FAMILIASANTOS\SQLEXPRESS; DATABASE = VIDEOCLUB ; Integrated Security= SSPI")
Dim bd1 As New SqlDataAdapter("Select *From CLIENTE", bd)
Dim bd2 As New DataSet
bd1.Fill(bd2, "CLIENTE")
Me.DataGridView1.DataSource = bd2.Tables("CLIENTE")
End Sub
El menú que esta seleccionado en la imagen se le conoce como:
ToolStrip,esta justo en la barra de Herramientas en Visual Basic.
Botones (Butons) Cliente, Bodega, Película, Alquiler.
Estos Botones (Buttons) deben ser insertados desde el menú de herramientas de Visual Basic. Tal como esta indicado en la Imagen.
Estos Botones (Buttons) estan codificados para abrir diferentes tipos de forms.
Los Botones llevan a distintos clases de Forms.
El Button Clientelleva a un Form también llamado Cliente (Form2)
El Button Bodega lleva a un Form tambien llamado Bodega (Form3)
El Button Pelicula lleva a un Form tambien llmado Pelicula (Form4)
El Button Alquiler lleva a un Form tambien llmado Alquiler (Form5)
Codigo Botones (Buttons):
Dim ABS As New Form2
ABS.Show()
Este Codigo de programacion es el mismo para todos los botones.
Solocambia el numero de Fomr.
El Button de Salida.
Es un modelo de uso para salir del Form1 de una manera limpia.
Codigo Button Salir:
End
Form a la Tabla Cliente:
DatagridView:
Selección de color Verde.
Permite mostrar lo contenido en la BD.
Los botones tienen selección de color Negro.
Button Insertar (Insert).
Codigo del Insert:
Private Sub Button1_Click(ByValsender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sSql As String
Dim oConextion As New SqlConnection
oConextion.ConnectionString = "Server= FAMILIASANTOS\SQLEXPRESS; DATABASE = VIDEOCLUB ; Integrated Security= SSPI"
sSql = "insert into CLIENTE values (" & "'" & TextBox1.Text & "'" & "," & "'" & TextBox2.Text &"'" & "," & "'" & TextBox3.Text & "'" & "," & "'" & TextBox4.Text & "')"
Dim oCommand As New SqlCommand(sSql, oConextion)
oConextion.Open()
oCommand.ExecuteNonQuery()
MessageBox.Show("DATOS INSERTADOS CON EXITO")
Dim bd As New SqlConnection("Server= FAMILIASANTOS\SQLEXPRESS; DATABASE = VIDEOCLUB ; IntegratedSecurity= SSPI")
Dim bd1 As New SqlDataAdapter("Select *From CLIENTE", bd)
Dim bd2 As New DataSet
bd1.Fill(bd2, "CLIENTE")
Me.DataGridView1.DataSource = bd2.Tables("CLIENTE")
oConextion.Close()
End Sub
Button Actualizar (UpDate).
Codigo de UpDate:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button3.Click
Dim sSql As String
Dim oConextion As New SqlConnection
oConextion.ConnectionString = "Server= FAMILIASANTOS\SQLEXPRESS; DATABASE = VIDEOCLUB ; Integrated Security= SSPI"
sSql = " UPDATE CLIENTE SET NOMBRECLIENTE=" & "'" & TextBox7.Text & "'" & "," & "TELCLIENTE= " & "'" & TextBox8.Text & "'" & "," &"DIRECCLIENTE=" & "'" & TextBox9.Text & "'" & "WHERE IDCLIENTE= " & "'" & ComboBox1.SelectedValue & "'"
Dim oCommand As New SqlCommand(sSql, oConextion)
oConextion.Open()
oCommand.ExecuteNonQuery()
MessageBox.Show("DATOS ACTUALIZADOS CON EXITO")
Dim bd As New SqlConnection("Server= FAMILIASANTOS\SQLEXPRESS;...
Regístrate para leer el documento completo.