Respuesta: Pasar fechas de formulario a Base de datos Mysql bueno cambie lo que me decias y ademas cambie los valores en la tabla a datatime antes tenia uno date y otro datatime quedo asi
Private Sub Laboratorios_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Textfechaingresado.Text = DateTime.Now() hh:mm:ss")
'crear la conexion
Dim oConexion As MySqlConnection
oConexion = New MySqlConnection
oConexion.ConnectionString = "Server=localhost;Database=prueba;Uid=root;Pwd=*** **;"
Dim sSel As String = "SELECT * FROM sel_lab ORDER BY idlaboratorios"
Try
da = New MySqlDataAdapter(sSel, oConexion)
dt = New DataTable
da.Fill(dt)
Catch ex As Exception
MsgBox("ERROR DE CONECCION")
End Try
'combobox
cbolab.DataSource = dt
cbolab.DisplayMember = "laboratorio"
cbolab.ValueMember = "idlaboratorios"
End Sub
Private Sub guardarremisiones_Click(sender As Object, e As EventArgs) Handles guardarremisiones.Click
'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", txtfechaentrega.Value)
cmd.Parameters.AddWithValue("?fechaingreso", Textfechaingresado.Text)
cmd.ExecuteNonQuery()
Dim Ds As New DataSet
Dim tabla As New DataTable
Dim objadap As New MySqlDataAdapter(sSel, oConexion)
oConexion.Open()
objadap.Fill(tabla)
End Sub
-----------------------
pero me sigue dando un error
No se controló MySql.Data.MySqlClient.MySqlException
ErrorCode=-2147467259
HResult=-2147467259
Message=Incorrect datetime value: '2013-08-27 12:32:53 p.m.' for column 'fecha_ingresado' at row 1
Number=1292
Source=MySql.Data
StackTrace:
en MySql.Data.MySqlClient.MySqlStream.ReadPacket()
en MySql.Data.MySqlClient.NativeDriver.GetResult(Int3 2& affectedRow, Int64& insertedId)
en MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)
en MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
en MySql.Data.MySqlClient.MySqlDataReader.NextResult( )
en MySql.Data.MySqlClient.MySqlCommand.ExecuteReader( CommandBehavior behavior)
en MySql.Data.MySqlClient.MySqlCommand.ExecuteReader( )
en MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuer y()
en SD_Opticas.Laboratorios.guardarremisiones_Click(Ob ject sender, EventArgs e) en C:\Users\CONTABILIDAD 84\Documents\Visual Studio 2012\Projects\SD Opticas\SD Opticas\Laboratorios.vb:línea 58
en System.Windows.Forms.Control.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
en System.Windows.Forms.Control.WndProc(Message& m)
en System.Windows.Forms.ButtonBase.WndProc(Message& m)
en System.Windows.Forms.Button.WndProc(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
en System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
en System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
en System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.Run(ApplicationCo ntext context)
en Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
en Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
en Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[] commandLine)
en SD_Opticas.My.MyApplication.Main(String[] Args) en 17d14f5c-a337-4978-8281-53493378c1071.vb:línea 81
en System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
en Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
en System.Threading.ThreadHelper.ThreadStart_Context( Object state)
en System.Threading.ExecutionContext.RunInternal(Exec utionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
en System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
en System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
en System.Threading.ThreadHelper.ThreadStart()
InnerException: |