Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8614251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:04:41+00:00 2026-06-12T05:04:41+00:00

I’ve been killing brain cell for over 5 hours with this question. how to

  • 0

I’ve been killing brain cell for over 5 hours with this question.
how to properly save a date from vb.net to mysql date without getting the 0000-00-00all the time.

I have tried multiple suggestions where you format the date value before entering but it gets me the same result ex:

Dim departDate As Date
Dim d As String = Format(departDate, "05/05/2007")

in which i tested and didnt works i still got the 0000-00-00

I’ve tried:

    Dim changeFormatDate As Date
    Dim AddFechaListadoCasas2 as String
    changeFormatDate = AddCasasListadoDatePicker.Text
    AddFechaListadoCasas2 = changeFormatDate.ToString("yyyy-MM-dd")

which still gives me on mysql the 0000-00-00

I also tried this example:

Dim myDate as DateTime = DateTime.ParseExact(x, "yyyy-MM-dd", CultureInfo.CurrentCulture)

and trying to save to mysql still gave me the 0000-00-00

in my program im grabbing the date from a datepicker as text then swtich it to a string and try to save it to the database like that. if necessary i would love to convert it to a date with the format yyyy-MM-dd which is necessary for MySQL but everything i’ve done above it still shows me the 0000-00-00 which is frustrating.

any help would be very appreciated it.

Leo

here is the MySQL insert statement i have on my program.

AddFechaListadoCasas2 = AddCasasListadoDatePicker.Text
        AddFechaCierreCasas2 = AddFechaCierreCasas.Text


SqlVentaCasas = "INSERT INTO VentaCasas (ID, Direccion, Ciudad_Municipio, Zona_Localidad, Barrio, " & _
                                    "Estatus, Precio, Unidad, Departamento, Conjunto, Estrato, Matricula_Inmobiliaria, Cedula_Catastral," & _
                                    "Escritura, Notaria, Ano, Area_Metros_2, Tipo_de_Construccion, Niveles, Habitaciones, Garajes," & _
                                    "Techo, Vista, Picina, Cocina_Integral, Bar, Cuarto_Bano_Servicio, Antejardin, Equipos," & _
                                    "Aire_Acondicionado, Detalles_addicionales, Estilo, Ano_Construccion, Orientacion, Banos, Parqueos," & _
                                    "Piso, Balcon, Jacuzzi_Sauna, Chimenea, Hall_Television, Zona_lavanderia, Patio, Accesorios," & _
                                    "Calefaccion, Administracion, Amenidades, Impuestos, Condiciones, Ocupacion," & _
                                    "Cuota_Administracion, Restricciones, Seguridad, Mostrar, Comision, Fecha_Listado, " & _
                                    "Agente_Cooperante, Fecha_Expiracion, CiudadEscritura, Agente, Licensia, Compania, NumeroPersonal," & _
                                    "NumeroCompania, NumeroFax, Email, AreaLotesM2, PrecioOriginal, Account_Creator, NumeroDias ) VALUES ('" & _
                                    AddIDCasas2 & "','" & _
                                    AddDireccionCasas2 & "','" & AddCiudadCasas2 & "','" & AddZonaCasas2 & "','" & AddBarrioCasas2 & "','" & _
                                    AddEstatusCasas2 & "'," & AddPrecioCasas2 & ",'" & AddUnidadCasas2 & "','" & AddDepartamentoCasas2 & "','" & _
                                    AddConjuntoCasas2 & "'," & AddEstratoCasas2 & ",'" & AddMatriculaCasas2 & "','" & _
                                    AddCedulaCatastralCasas2 & "','" & AddEscrituraCasas2 & "','" & AddNotariaCasas2 & "'," & _
                                    AddAnoCasas2 & "," & AddMetros2Casas2 & ",'" & AddTipoConstruccionCasas2 & "'," & _
                                    AddNivelesCasas2 & "," & AddHabitacionesCasas2 & "," & AddGarajesCasas2 & ",'" & _
                                    AddTechoCasas2 & "','" & AddVistaCasas2 & "','" & AddPicinaCasas2 & "','" & AddCocinaIntegralCasas2 & "','" & _
                                    AddBarCasas2 & "','" & AddCuartoCasas2 & "','" & AddAnteJardinCasas2 & "','" & AddEquiposCasas2 & "','" & _
                                    AddAireAcondicionadoCasas2 & "','" & AddDetallesAddicionalesCasas2 & "','" & AddEstiloCasas2 & "'," & _
                                    AddAnoConstruccionCasas2 & ",'" & AddOrientacionCasas2 & "'," & AddBanoCasas2 & "," & _
                                    AddParqueoCasas2 & ",'" & AddPisoCasas2 & "','" & AddBalconCasas2 & "','" & AddJacuzziCasas2 & "','" & _
                                    AddChimeneaCasas2 & "','" & AddTVCasas2 & "','" & AddZonaLavanderiaCasas2 & "','" & AddPatioCasas2 & "','" & _
                                    AddAccesoriosCasas2 & "','" & AddCalefaccionCasas2 & "','" & AddAdministracionCasas2 & "','" & _
                                    AddAmenidadesCasas2 & "','" & AddImpuestosCasas2 & "','" & AddCondicionesCasas2 & "','" & _
                                    AddOcupacionCasas2 & "','" & AddCuotaAdministracionCasas2 & "','" & AddRestriccionesCasas2 & "','" & _
                                    AddSeguridadCasas2 & "','" & AddMonstrarCasas2 & "','" & AddComisionCasas2 & "','" & _
                                    AddFechaListadoCasas2 & "','" & AddAgenteCooperanteCasas2 & "','" & _
                                    AddFecdhaExpiracionCasas2 & "','" & _
                                    AddCiudadEscrituraCasas2 & "','" & AgenteNameCasas2 & "','" & _
                                    AgenteLicensiaCasas2 & "','" & AgenteCompaniaCasas2 & "','" & _
                                    AgentePersonalCasas2 & "','" & AgenteTelefonoCasas2 & "','" & _
                                    AgenteFaxCasas2 & "','" & AgenteEmailCasas2 & "'," & AddAreaLotesM2Casas2 & "," & AddPrecioOriginalCasas2 & ", '" & AgenteAccountCreatorCasas2 & "', 0 );"

AddFechaListadoCasas2 and AddFecdhaExpiracionCasas2 are Strings that contains the date i want to input on MySQL

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:04:42+00:00Added an answer on June 12, 2026 at 5:04 am

    Your current query is vulnerable with SQL Injection. Please make use of ADONet Object such as Connection and Command with parameters. To be more specific, since you are using MySQL, use MySQL Data provider. It will automatically cast the data types for you.

    Dim query As String = "INSERT INTO tableName (dateColumn) VALUES (@dateParam)"
    Using conn As New MySqlConnection("connectionstringHere")
        Using comm As New MySqlCommand()
            With comm
                .Connection = conn
                .CommandText = query
                .CommandType = Commandtype.Text
                ' Assuming this is a DatePicker '
                .Parameters.AddWithValue("@dateParam", AddCasasListadoDatePicker.Value) 
            End With
            Try
                conn.Open()
                comm.ExecuteNonQuery()
            Catch(ex as MySqlException)
                Msgbox(ex.Message.ToString())
            End Try
        End Using
    End Using
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.