简体   繁体   中英

vb.net mysql insert commande with date

i want to insert into the table from vb.net and i get this error "Incorrect datetime value: '28/03/2020' for function str_to_date"

  cmd.CommandText = "insert into ventes (idc,totale,date) value (@P1, @P2,STR_TO_DATE(@P3,'%d-%M-%Y'))"
        cmd.Parameters.AddWithValue("@P1", ComboBox2.SelectedValue)
        cmd.Parameters.AddWithValue("@P2", TextBox12.Text)
        cmd.Parameters.AddWithValue("@P3", TextBox2.Text)

Maybe read about how to specify a date format here . According to that, %M is for the month name in full while %m is for the month as a number. It took me less than a minute to find that information by simply searching for "mysql str_to_date". If a solution is that easy to find, the question should not have been asked in the first place.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM