
Error En visual Studio 2010
Publicado por Carlos (1 intervención) el 04/04/2014 12:11:11
fatal error encountered during command execution
Me da ese error cuando le doy a un boton "guardar" para guardar los datos del formulario en mi base de datos, alguien sabría como solucionarlo, aqui os pego el codigo correspondiente
ESTA ES LA CLASE INTRODUCIR DATOS
ESTE ES EL MODULO CONEXION GLOBAL
Y POR ULTIMO EL BOTON GUARDAR
MUCHAS GRACIAS POR LAS MOLESTIAS
Me da ese error cuando le doy a un boton "guardar" para guardar los datos del formulario en mi base de datos, alguien sabría como solucionarlo, aqui os pego el codigo correspondiente
ESTA ES LA CLASE INTRODUCIR DATOS
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
Imports MySql.Data
Imports MySql.Data.Types
Imports MySql.Data.MySqlClient
Public Class Class_int
Private _adpatator As New MySqlDataAdapter
Public Function insertarDatos(ByVal datos As Class_datos) As Boolean
Dim estado As Boolean = True
Try
conexion_Global()
_adpatator.InsertCommand = New MySqlCommand("insert INTO fichas (CLIENTE, MARCA,TIPO_VARIANTE_VERSION)values(@CLIENTE,@MARCA,@TIPO_VARIANTE_VERSION)", _conexion)
_adpatator.InsertCommand.parameters.Add("@CLIENTE", MySqlDbType.VarChar, 45).Value = datos.CLIENTE
_adpatator.InsertCommand.parameters.Add("@MARCA", MySqlDbType.VarChar, 45).Value = datos.MARCA
_adpatator.InsertCommand.Parameters.Add("@TIPO_VARIANTE_VERSION", MySqlDbType.VarChar, 45).Value = datos.TIPO_VARIANTE_VERSION
_conexion.Open()
_adpatator.InsertCommand.Connection = _conexion
_adpatator.InsertCommand.ExecuteNonQuery()
Catch ex As MySqlException
MessageBox.Show(ex.Message)
estado = False
Finally
cerrar()
End Try
Return estado
End Function
End Class
ESTE ES EL MODULO CONEXION GLOBAL
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
Imports MySql.Data
Imports MySql.Data.Types
Imports MySql.Data.MySqlClient
Module Module1
Public _cadena As String
Public _conexion As New MySqlConnection
Public Function conexion_Global() As Boolean
Dim estado As Boolean = True
Try
_cadena = ("server=localhost;user id=root;password=pass;database=fichas_reducidas")
_conexion = New MySqlConnection(_cadena)
Catch ex As Exception
MessageBox.Show(ex.Message)
estado = False
End Try
Return estado
End Function
Public Sub cerrar()
_conexion.Close()
End Sub
End Module
Y POR ULTIMO EL BOTON GUARDAR
1
2
3
4
5
6
7
8
9
10
11
12
13
Private Sub guardar_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles guardar.Click
Dim conexion As New Class_int
Dim datos As New Class_datos
datos.CLIENTE = TextBox61.Text
datos.MARCA = TextBox2.Text
datos.TIPO_VARIANTE_VERSION = TextBox5.Text
If conexion.insertarDatos(datos) Then
MessageBox.Show("Datos guardados")
Else : MessageBox.Show("Datos no guardados")
End If
End Sub
MUCHAS GRACIAS POR LAS MOLESTIAS
Valora esta pregunta


0