Answer the question
In order to leave comments, you need to log in
Why doesn't it understand the date type?
There is a change request in Qt like this:
setquery1->setQuery("UPDATE ships SET n_sudopot = '"+N_sp+"', data_prib_p_nazn = '"+data_prib.toString()+"', "
"dispetcher = '"+dispetcher+"' WHERE id="+indid+";");
data_prib_p_nazn
in MySQL it is of type DATE; data_prib
QDate data_vih = ui->dateEdit->date();
QString data_vih = ui->dateEdit->date().toString();
Answer the question
In order to leave comments, you need to log in
According to the specification, the DATE type in SQL looks like this: yyyy-mm-dd. We go into the Qt documentation and see one of the signatures ( doc.qt.io/qt-5/qdate.html#toString-1 ):
QString QDate::toString(Qt::DateFormat format = Qt::TextDate) const
Ie . you need it like this: ui->dateEdit->date().toString(Qt::ISODate)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question