Ver Mensaje Individual
  #13 (permalink)  
Antiguo 27/08/2013, 15:30
netspider76
 
Fecha de Ingreso: julio-2013
Ubicación: Colombia
Mensajes: 11
Antigüedad: 11 años, 7 meses
Puntos: 0
Respuesta: Pasar fechas de formulario a Base de datos Mysql

Cita:
Iniciado por gnzsoloyo Ver Mensaje
Postea el código completo de lo que estás haciendo en ese método (todo el Sub o la Function donde haces uso de las Exception).
Private Sub guardarremisiones_Click(sender As Object, e As EventArgs) Handles guardarremisiones.Click

Dim fecha As DateTime
fecha = txtfechaentrega.Value
'crear la conexion
Dim oConexion As MySqlConnection
oConexion = New MySqlConnection
oConexion.ConnectionString = "Server=localhost;Database=prueba;Uid=root;Pwd=*** **;"
oConexion.Open()

Dim sSel As String = "insert into laboratorios72(caja,factura,laboratorio,fecha_entr ega,fecha_ingresado)values(?caja, ?factura, ?lab, ?fechaentrega, ?fechaingreso)"

Dim cmd As New MySqlCommand(sSel, oConexion)
cmd.Parameters.AddWithValue("?caja", txtcaja.Text)
cmd.Parameters.AddWithValue("?factura", txtfactura.Text)
cmd.Parameters.AddWithValue("?lab", cbolab.Text)
'cmd.Parameters.AddWithValue("?fechaentrega", CDate(txtfechaentrega.Text))
'cmd.Parameters.AddWithValue("?fechaingreso", DateTime.Parse(Textfechaingresado.Text))
cmd.Parameters.AddWithValue("?fechaentrega", txtfechaentrega.Value)
cmd.Parameters.AddWithValue("?fechaingreso", fecha)
cmd.ExecuteNonQuery()
oConexion.Close()

Dim Ds As New DataSet
Dim tabla As New DataTable
Dim objadap As New MySqlDataAdapter(sSel, oConexion)

Try

oConexion.Open()
objadap.Fill(tabla)
oConexion.Close()

Catch e As MySqlException
' Acá se pone todo lo que se quiere hacer o mostrar en caso de una Exception de MySQL
'en caso de error

MessageBox.Show(e.Message)
'Catch ex As Exception

' Acá el resto de las excepciones
'en caso de error
'MsgBox("ERROR DE CONECCION")
End Try


End Sub
---------------

hay ta el sub completo