Hi,
I'm trying to query the week of the year on a MySQL server.
QString qQuery
= "select WEEKOFYEAR(CURDATE())";
bool bRes = qSQLQuery.exec(qQuery);
int iCols = qRecord.count(); //Returns me "1"
QString qWeekDay
= qSQLQuery.
value(0).
toString();
QString qQuery = "select WEEKOFYEAR(CURDATE())";
QSqlQuery qSQLQuery(m_qBD);
bool bRes = qSQLQuery.exec(qQuery);
QSqlRecord qRecord= qSQLQuery.record();
int iCols = qRecord.count(); //Returns me "1"
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:
QString qQuery
= "select DATEPART(weekday, GETDATE())";
bool bRes = qSQLQuery.exec(qQuery);
int iCols = qRecord.count();
QString qWeekDay
= qSQLQuery.
value(0).
toString();
QString qQuery = "select DATEPART(weekday, GETDATE())";
QSqlQuery qSQLQuery(m_qBD);
bool bRes = qSQLQuery.exec(qQuery);
QSqlRecord qRecord = qSQLQuery.record();
int iCols = qRecord.count();
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,
Bookmarks