Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
SqlClient
Public Class WebForm1
Inherits System.Web.UI.Page
Dim Sqlg As String
Protected Sub BTNGuardar_Click(sender As Object, e As EventArgs) Handles
BTNGuardar.Click
' Validar()
Try
EmpleadoConexion.AbrirConexion()
EmpleadoConexion.Cadena.Open()
'iNSERTAR VALORES
Sqlg = " INSERT INTO Empleado"
Sqlg = Sqlg & " (Nombre, Salario, Puesto, RFC) VALUES"
Sqlg = Sqlg & "('" & TxtNombre.Text & "',' " & TxtSalario.Text & "','"
Sqlg = Sqlg & TxtPuesto.Text & "','" & TxtRFC.Text & "')"
Dim Comando As New SqlClient.SqlCommand(Sqlg, EmpleadoConexion.Cadena)
Comando.ExecuteNonQuery()
Limpiar()
MsgBox("Correcto")
TxtNombre.Focus()
Catch ex As Exception
MsgBox(ex)
End Try
EmpleadoConexion.Cadena.Close()
End Sub
Sub Limpiar()
TxtClaveEmpleado.Text = ""
TxtNombre.Text = ""
TxtPuesto.Text = ""
TxtRFC.Text = ""
TxtSalario.Text = ""
End Sub
Catch ex As Exception
MsgBox(ex)
End Try
EmpleadoConexion.Cadena.Close()
TxtClaveEmpleado.Enabled = False
End Sub
Catch ex As Exception
MsgBox(ex)
End Try
TxtClaveEmpleado.Enabled = True
End Sub