buenas espero que esten bien quiero que me hagan el favor y me ayuden con esto tengo un formulario hecho en plataforma windows llamado registro de ausencias tengo un boton guardar donde me guarda la ausencia de cada empleado en el formulario tengo unos label, unas cajas de texto y un datatimepicker que me muestra la hora el problema que tengo es que cuando guardo en la base de datos la fecha no mel aguarda bien me la guarda con el año de 1900. les ruego les pido con toda amabilidad y me ayuden, un amigo me dijo que cambiara el datatimepicker por un texboxt y le colocara el formato de fecha, lo malo es que no se como se hace, he buscado por internet y no he conseguido por ahora nada. les voy a mostrar algo del codigo para ver si me ayudan
Private
Sub Guardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Guardar.Click
If txtid.Text = "" Then
MsgBox(
"debe digitar una identificacion")
txtid.Focus()
Exit Sub
Else
If Cbosecc.Text <> "" And Cbomot.Text <> "" Then
Dim command As SqlCommand
command =
New SqlCommand
command.Connection = con
command.CommandText =
"insert into Motivo_Ausencia (Identificacion,NombreCausa,FechaCausa,HoraCausa,Observaciones)values(" & "'" & txtid.Text & "'" & "," & "'" & Cbomot.Text & "'" & "," & DateTimePickerFormat.Time & "," & "'" & txth.Text & "'" & "," & "'" & txtobs.Text & "'" & ")"
command.ExecuteNonQuery()
command.Connection.Close()
If command.Connection.State = ConnectionState.Closed Then
MessageBox.Show(
"ausencia registrada")
txtid.Enabled =
True
txtnom.Enabled =
True
txtap.Enabled =
True
txtsa.Enabled =
True
Cbomot.Enabled =
True
Dtpmes.Enabled =
True
txth.Enabled =
True
txtobs.Enabled =
True
Buscar.Enabled =
False
End If
'habilitar controles
txtid.Enabled =
False
txtnom.Enabled =
False
txtap.Enabled =
False
txtsa.Enabled =
False
Cbosecc.Enabled =
False
Cbomot.Enabled =
False
Dtpmes.Enabled =
False
txth.Enabled =
False
txtobs.Enabled =
False
'habilitar botones
Ingresar.Enabled =
True
Guardar.Enabled =
True
Modificar.Enabled =
False
Actualizar.Enabled =
False
Buscar.Enabled =
True
Eliminar.Enabled =
False
Cancelar.Enabled =
True
'limpiar controles
txtid.Text =
" "
txtnom.Text =
" "
txtap.Text =
""
txtsa.Text =
" "
Cbosecc.Text =
" "
Cbomot.Text =
" "
txth.Text =
" "
txtobs.Text =
""
txtid.Focus()
End If
End If
End Sub
gracias por su gran ayuda