0

Hello everyone has been a while since i made a question here

i have a real problem with a web app that i been doing recently the problem is related with the datetime format when i make transfer data from the webapp to a database in access, the field in access has the property of date/time format and its format is in general date,
everything is ok when i pass the data in my page but when i try to check the infomation that i captured the format in the database it´s wrong.
an example of this capture 05/10/2016 06:37 pm (Tuesday, May 10, 2016) and when i check the database it show 10/05/2016 06:37 pm(Tuesday, Oct 10, 2016) this its a real problem because all the information and the validation is based in the exact datetime

Any kind of help will be great
there´s a comment in the 25 line

imports system.Data
Imports System.Data.OleDb
Imports System.Net.Mail
Imports System.Net
Imports System.Threading

Partial Class checklist
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

        Dim tur As String
        tur = TimeOfDay.ToString("HH:mm")
        turno.Text = tur
        If tur >= "06:00" And tur <= "14:00 PM" Then
            DropDownList1.SelectedIndex = 1
        ElseIf tur >= "14:00" And tur <= "22:00" Then
            DropDownList1.SelectedIndex = 2
        ElseIf tur >= "22:00" And tur <= "24:59" Then
            DropDownList1.SelectedIndex = 3
        ElseIf tur >= "00:00" And tur <= "06:30" Then
            DropDownList1.SelectedIndex = 3
        End If

        fecha.Text = DateAndTime.DateString.ToString
        TextBox2.Text = (now.ToString("dd/MM/yyyy hh:mm:ss tt"))'''this is the line of the code that load the datetime into a textbox for transfer after the button click is pressed

        TextBox3.Text = DatePart(DateInterval.WeekOfYear, Now)
        If TextBox6.Text = "" Then
            TextBox6.Text = "SC"
        End If
    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim now As DateTime = DateTime.Now
        Dim cn As New OleDbConnection
        Dim cm As New OleDbCommand
        Dim mail As New MailMessage()
        Dim texto As String
        Dim smtp As New SmtpClient("smtp.logistics.corp")

        cn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\MXDTBTZ3XC1\Users\MXDTBTZ3XC1\Desktop\CHECKLIST.accdb")
        cn.Open()
        With cm
            .Connection = cn
            .CommandText = "INSERT INTO EQUIPOS(TURNO, DIA, SEMANA, NO_VEHICULO, AREA_ASIGNADA, PORCENTAJE_BATERIA, CAMBIO_DE_PILA, BATERIA_CON_SARRO, CONEXIONES_DE_BATERIA_CUBIERTAS_DE_CELDA, CONEXIONES_DE_BATERIA_TERMINALES_EN_SU_LUGAR, CONEXIONES_DE_BATERIA_CABLES_ROTOS, LLANTAS_ESTADO, FUGAS_DE_LIQUIDO_LEVE_MODERADA_O_CONSIDERABLE, AMARRE_DE_OP_CON_CANASTILLA, EXTINTOR, GUARDAS_DE_MANOS_ESTADO, ESTADO_DE_LA_PARRILLA, CUCHILLAS_NIVELADAS, FRENO_DE_MANO_FUNCIONANDO, LIMPIEZA_DE_MONTACARGAS, INDICADOR_DE_CARGA_FUNCIONANDO, CLAXON_EN_FUNCIONAMIENTO, FRENOS_ESTADO, ALARMA_DE_REVERSA_FUNCIONANDO, LECTURA_DE_HOROMETRO, DIRECCION_ESTADO, TABLERO_DE_CONTROLES_HIDRAULICO_FUNCIONANDO, LUCES_EN_BUEN_ESTADO, FUNCIONAMIENTO_BOTON_DE_EMERGENCIA, ETIQUETAS_DE_IDENTIFICACION_ARNES, CORREAS_ESTADO_ARNES, PARTES_METALICAS_ESTADO_ARNES, PIEZAS_PLASTICAS_ESTADO_ARNES, COMENTARIOS, NOMBRE_DE_USUARIO, FECHA) VALUES(@TURNO, @DIA, @SEMANA, @NO_VEHICULO, @AREA_ASIGNADA, @PORCENTAJE_BATERIA, @CAMBIO_DE_PILA, @BATERIA_CON_SARRO, @CONEXIONES_DE_BATERIA_CUBIERTAS_DE_CELDA, @CONEXIONES_DE_BATERIA_TERMINALES_EN_SU_LUGAR, @CONEXIONES_DE_BATERIA_CABLES_ROTOS, @LLANTAS_ESTADO, @FUGAS_DE_LIQUIDO_LEVE_MODERADA_O_CONSIDERABLE, @AMARRE_DE_OP_CON_CANASTILLA, @EXTINTOR, @GUARDAS_DE_MANOS_ESTADO, @ESTADO_DE_LA_PARRILLA, @CUCHILLAS_NIVELADAS, @FRENO_DE_MANO_FUNCIONANDO, @LIMPIEZA_DE_MONTACARGAS, @INDICADOR_DE_CARGA_FUNCIONANDO, @CLAXON_EN_FUNCIONAMIENTO, @FRENOS_ESTADO, @ALARMA_DE_REVERSA_FUNCIONANDO, @LECTURA_DE_HOROMETRO, @DIRECCION_ESTADO, @TABLERO_DE_CONTROLES_HIDRAULICO_FUNCIONANDO, @LUCES_EN_BUEN_ESTADO, @FUNCIONAMIENTO_BOTON_DE_EMERGENCIA, @ETIQUETAS_DE_IDENTIFICACION_ARNES, @CORREAS_ESTADO_ARNES, @PARTES_METALICAS_ESTADO_ARNES, @PIEZAS_PLASTICAS_ESTADO_ARNES, @COMENTARIOS, @NOMBRE_DE_USUARIO, @FECHA)"
            .Parameters.AddWithValue("@TURNO", DropDownList1.SelectedValue)
            .Parameters.AddWithValue("@DIA", TextBox2.Text)
            .Parameters.AddWithValue("@SEMANA", TextBox3.Text)
            .Parameters.AddWithValue("@NO_VEHICULO", DropDownList2.SelectedValue)
            .Parameters.AddWithValue("@AREA_ASIGNADA", DropDownList3.SelectedValue)
            .Parameters.AddWithValue("@PORCENTAJE_BATERIA", TextBox4.Text)
            .Parameters.AddWithValue("@CAMBIO_DE_PILA", DropDownList4.SelectedValue)
            .Parameters.AddWithValue("@BATERIA_CON_SARRO", DropDownList5.SelectedValue)
            .Parameters.AddWithValue("@CONEXIONES_DE_BATERIA_CUBIERTAS_DE_CELDA", DropDownList6.SelectedValue)
            .Parameters.AddWithValue("@CONEXIONES_DE_BATERIA_TERMINALES_EN_SU_LUGAR", DropDownList7.SelectedValue)
            .Parameters.AddWithValue("@CONEXIONES_DE_BATERIA_CABLES_ROTOS", DropDownList8.SelectedValue)
            .Parameters.AddWithValue("@LLANTAS_ESTADO", DropDownList9.SelectedValue)
            .Parameters.AddWithValue("@FUGAS_DE_LIQUIDO_LEVE_MODERADA_O_CONSIDERABLE", DropDownList10.SelectedValue)
            .Parameters.AddWithValue("@AMARRE_DE_OP_CON_CANASTILLA", "N/A")
            .Parameters.AddWithValue("@EXTINTOR", DropDownList12.SelectedValue)
            .Parameters.AddWithValue("@GUARDAS_DE_MANOS_ESTADO", "N/A")
            .Parameters.AddWithValue("@ESTADO_DE_LA_PARRILLA", DropDownList15.SelectedValue)
            .Parameters.AddWithValue("@CUCHILLAS_NIVELADAS", DropDownList16.SelectedValue)
            .Parameters.AddWithValue("@FRENO_DE_MANO_FUNCIONANDO", "N/A")
            .Parameters.AddWithValue("@LIMPIEZA_DE_MONTACARGAS", DropDownList18.SelectedValue)
            .Parameters.AddWithValue("@INDICADOR_DE_CARGA_FUNCIONANDO", DropDownList19.SelectedValue)
            .Parameters.AddWithValue("@CLAXON_EN_FUNCIONAMIENTO", DropDownList20.SelectedValue)
            .Parameters.AddWithValue("@FRENOS_ESTADO", DropDownList21.SelectedValue)
            .Parameters.AddWithValue("@ALARMA_DE_REVERSA_FUNCIONANDO", DropDownList22.SelectedValue)
            .Parameters.AddWithValue("@LECTURA_DE_HOROMETRO", TextBox5.Text)
            .Parameters.AddWithValue("@DIRECCION_ESTADO", DropDownList23.SelectedValue)
            .Parameters.AddWithValue("@TABLERO_DE_CONTROLES_HIDRAULICO_FUNCIONANDO", DropDownList24.SelectedValue)
            .Parameters.AddWithValue("@LUCES_EN_BUEN_ESTADO", DropDownList25.SelectedValue)
            .Parameters.AddWithValue("@FUNCIONAMIENTO_BOTON_DE_EMERGENCIA", DropDownList26.SelectedValue)
            .Parameters.AddWithValue("@ETIQUETAS_DE_IDENTIFICACION_ARNES", "N/A")
            .Parameters.AddWithValue("@CORREAS_ESTADO_ARNES", "N/A")
            .Parameters.AddWithValue("@PARTES_METALICAS_ESTADO_ARNES", "N/A")
            .Parameters.AddWithValue("@PIEZAS_PLASTICAS_ESTADO_ARNES", "N/A")
            .Parameters.AddWithValue("@COMENTARIOS", TextBox6.Text)
            .Parameters.AddWithValue("@NOMBRE_DE_USUARIO", TextBox7.Text)
            .Parameters.AddWithValue("@FECHA", fecha.Text)
            cm.ExecuteNonQuery()
            cn.Close()
        End With
        End Sub

Edited by pezzinae

2
Contributors
2
Replies
7
Views
1 Year
Discussion Span
Last Post by pezzinae
0

Hello rproffitt

thanks for your advice

i was able to complete my requirement doing this i hope this be helpful for someone

Dim fech As System.DateTime
        Dim lig As String
        fech = DateString.ToString
         lig = TimeOfDay.ToString("hh:mm:ss tt")
        TextBox2.Text = fech & " " & lig
        End If
    End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.