Hi,

I'm trying to query the week of the year on a MySQL server.

Qt Code:
  1. QString qQuery = "select WEEKOFYEAR(CURDATE())";
  2. QSqlQuery qSQLQuery(m_qBD);
  3. bool bRes = qSQLQuery.exec(qQuery);
  4. QSqlRecord qRecord= qSQLQuery.record();
  5. int iCols = qRecord.count(); //Returns me "1"
  6. QString qWeekDay = qSQLQuery.value(0).toString();
To copy to clipboard, switch view to plain text mode 

The result "qWeekDay" is an empty QString.
I have tryied it to a SQL Server via ODBC driver:
Qt Code:
  1. QString qQuery = "select DATEPART(weekday, GETDATE())";
  2. QSqlQuery qSQLQuery(m_qBD);
  3. bool bRes = qSQLQuery.exec(qQuery);
  4. QSqlRecord qRecord = qSQLQuery.record();
  5. int iCols = qRecord.count();
  6. QString qWeekDay = qSQLQuery.value(0).toString();
To copy to clipboard, switch view to plain text mode 
And I'm getting the same value, an empty QString.

I know that QDate let me obtaing this information but I want to query the DB Server to get always the same values on different workstations.

Thanks,