No se establecio ningun texto de comando para el objeto de comando
Publicado por Ottneiber (2 intervenciones) el 20/03/2018 14:52:47
Buenas, Agradezco su ayuda para verificar este problema cuando trato de guardar la informacion,
Al parecer me da problemas en la linea 54, con la variable comm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Public Class Personal
' Declaro objeto e inicalizo para hacer conccion a Base de Datos
Public conexion As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Bodega\Bodega.accdb")
'por medio de este objeto vouuy a enviar todos los comandos SQL a la tabla por medio de a conección
Public comm As New OleDb.OleDbCommand
Private txt_fecha_ingreso As Integer
' A cargar el la pantalla intenta conectarse a la base de datos
Private Sub BtnSalir_Click(sender As Object, e As EventArgs) Handles BtnSalir.Click
Mnu_Ppal.Show()
Me.Close()
End Sub
Private Sub Personal_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
'trato de abrir a coneccion
conexion.Open()
'inicalizo el objeto command
comm.Connection = conexion
comm.CommandType = CommandType.Text
Catch ex As Exception
If Err.Number = 5 Then
MsgBox("No se pudo encontrar el archuvo de Base de Datos")
End
Else
MsgBox(Err.Description)
End
End If
End Try
End Sub
Private Sub BtnNuevo_Click(sender As Object, e As EventArgs) Handles BtnNuevo.Click
End Sub
Private Sub BtnAceptar_Click(sender As Object, e As EventArgs) Handles BtnAceptar.Click
If Txt_Documento.Text = "" Then
MsgBox("Falta Ingresar el Número de Documento")
Txt_Documento.Focus()
Else
Dim Sql As String
Sql = " Insert into PERSONAL (Documento,nombres,fecha_ingreso,Area_trabajo)values('" & Txt_Documento.Text & "','" & Txt_Nombres.Text & "','" & TxtFechaIngreso.Text & "','" & Txt_LugarTrabajo.Text & "')"
MsgBox(Sql)
Try
comm.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString)
'MsgBox(Err.Number & " -" & Err.Description)
End Try
End If
End Sub
End Class
Al parecer me da problemas en la linea 54, con la variable comm
Valora esta pregunta


0