
problemas con sql
Publicado por Jonatan Daniel Pionsi (5 intervenciones) el 06/07/2017 12:48:11
hola como estan tengo este codigo el cual. realiza un insert en 3 tablas diferentes (novedades_clientes; libro_diario; auditoria).. esto andaba por alguna razon ahora no y me estoy volviendo loco. el problema creo que esta que no pasa por el segundo try.. o sea el primer insert lo realiza y se sale. si yo saco el pedazo de codigo del segundo insert referido al "libro_diario" me anda perfecto. lo que me hace pensar que tengo un error en el segundo insert pero no encuentro la solucion. si alguien me ayuda se lo agradeceria saludos! y graciasssssssssss
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
If (Me.txtentrega.Text <> "") Then
aux = (txtentrega.Text) * -1
debe1 = Val(txtentrega.Text)
Dim codcliente As Integer
Dim fechanove As DateTime
codcliente = txtcodigo.Text
fechanove = Now.Date
cmd2.CommandType = CommandType.Text
cmd2.Connection = conn
sql = "insert into novedades_clientes (codcliente, fechanovedad, impnovedad) "
sql += "values (" & codcliente & ",'" & fechanove & "','" & aux & "')"
cmd2.CommandText = sql
Try
cmd2.ExecuteNonQuery()
MsgBox("Se actualizo correctamente la cuenta corriente del Cliente", MsgBoxStyle.Information, "Exito")
Dim fec As DateTime
Dim detalle As String = ""
detalle = "EntregaDeDinero"
detalle = detalle.ToUpper
fec = Now.Date
cmd7.CommandType = CommandType.Text
cmd7.Connection = conn
cmd7.CommandText = "insert into libro_diario (fecha, concepto, detalle, debe, haber) values ('" & fec & "'," & codconcepto22 & ",'" & detalle & "','" & debe1 & "','" & 0 & "')"
MsgBox(cmd7.CommandText)
Try
cmd7.ExecuteNonQuery()
MsgBox("Se ha generado automaticamente un nuevo Registro de Ingresos/Egresos", MsgBoxStyle.Information, "Exito.!")
Dim fecha As DateTime
Dim accion As String = ""
Dim formulario As String = ""
fecha = DateAndTime.Now
accion = "Dinero a Cuenta"
formulario = "Entrega a Cuenta Cliente"
cmdaud.CommandType = CommandType.Text
cmdaud.Connection = conn
'GUARDO LOS CAMBIOS EN LA TABLA AUDITORIA.
cmdaud.CommandText = "insert into auditoria (aud_codusu, aud_usuario, aud_accion, aud_formulario, aud_fecha)"
cmdaud.CommandText += "values (" & codigo & ",'" & usuario & "','" & accion & "','" & formulario & "','" & fecha & "')"
Try
cmdaud.ExecuteNonQuery()
MsgBox("hech")
Catch ex As Exception
errorauditoria()
End Try
Catch
MsgBox("errorlibro")
End Try
lblayuda4.Visible = False
lblayuda.Visible = False
Button3.Visible = True
btnreiniciar.Visible = False
btnconfirmar.Visible = False
Button1.Visible = True
lblcodigo.Visible = False
lblNombre.Visible = False
lbldomicilio.Visible = False
lblsaldo.Visible = False
lblentrega.Visible = False
txtcodigo.Visible = False
txtnombre.Visible = False
txtapellido.Visible = False
txtdomicilio.Visible = False
txtnumero.Visible = False
txtsaldo.Visible = False
txtentrega.Visible = False
txtcodigo.Text = ""
txtnombre.Text = ""
txtdomicilio.Text = ""
txtsaldo.Text = ""
txtentrega.Text = ""
aux = ""
cmbcliente.Enabled = True
cmbcliente.Select()
Catch
End Try
ElseIf (Me.txtentrega.Text = "") Then
MsgBox("El campo Entrega debe contener algun dato válido.!", MsgBoxStyle.Exclamation, "Atención")
txtentrega.Focus()
End If
Valora esta pregunta


0