选择估算组合框,日期和时间
select estimate comboBox,date et time
我想选择一个ComboBox的内容,和DateEdit TimeEdit这行不通它只显示mat字段
QSqlQuery qry;
qry.prepare("select * from Etudiant");
if(qry.exec()){
while(qry.next()){
ui->lineEdit_matE->setText(qry.value(0).toString());
ui->comboBox_sexE->setCurrentIndex(qry.value(1).toInt());
ui->dateEdit_dateA->setDate(qry.value(2).toDate());
ui->timeEdit_heureA->setTime(qry.value(3).toTime());
}
}
QSqlQuery qry;
qry.prepare("select * from Etudiant");
if(qry.exec()){
if(qry.next) {
do{
ui->lineEdit_matE->setText(qry.value(0).toString());
ui->comboBox_sexE->setCurrentIndex(qry.value(1).toInt());
ui->dateEdit_dateA->setDate(qry.value(2).toDate());
ui->timeEdit_heureA->setTime(qry.value(3).toTime());
}while(qry.next());
}
else {
qDebug << "No results found.";
}
}
else
{
qDebug << "Unable to execute query."
}
您将看到它是否返回一个值
相关文章:
- 使用 C++将时间戳转换为格式化的日期时间
- C++代码的 C# 日期时间等效项是什么?
- 如何在提升日期时间中创建日期范围?
- 在 c++ 中将 ISO 日期时间转换为本地日期时间并提取时间
- Rcpp/C++/R:比较日期时间矢量与日期时间时出错(错误:"运算符>"的不明确重载)
- 如何将毫秒的日期时间字符串转换为 UNIX 时间戳
- 扩展中的日期时间对象方法C++问题
- 将DateTime字符串分为C 的日期时间
- C++以微秒为单位解析日期/时间
- 仅将纪元字符串保存到 mysql 日期时间年/月/日,但没有小时分钟秒
- 使用提升解析日期时间字符串:采用个位数小时格式
- C++ Poco SQL 查询不返回具有'between'和'and'日期时间绑定的结果
- 快速将带有时区的日期时间字符串转换为 UNIX 时间戳(C++)
- 从C 的时间戳提取日期时间戳
- 标准::get_time 中的日期时间格式
- 生成包含分数和时区的完整 iso 日期时间表示字符串
- 通过 ODBC C++将带有日期时间的记录插入 SQL Server 2014 的问题
- 在 C++20 中获取当前日期/时间是否线程安全?
- mongocxx:插入日期时间
- Poco 日期时间格式化程序 - 使用当前时区打印时间戳