-1
我無法使用VS2013從mySQL表中讀取DATETIME值。
我使用的MySQL連接器-1.1.9-Win32的(mysqlcppconn.lib)在C++中獲取mySQL DATETIME值
this is the row containing the datas
這裏是我的代碼:
sql::mysql::MySQL_Driver* m_driver;
sql::Connection* m_conn;
sql::Statement* m_stmt;
sql::ResultSet* m_res;
m_driver = sql::mysql::get_driver_instance();
m_conn = m_driver->connect(ch_hostName, ch_userName, ch_pwd);
m_stmt = m_conn->createStatement();
m_res = m_stmt->executeQuery("select tip, id1, datum from recordLocker where id1 = 'A0001' and tip = 1");
try
{
m_res->getString("datum");
}
catch (sql::SQLException& e)
{
TRACE1("\nSQL Error %d\n", e.getErrorCode());
}
我歌廳 「SQL錯誤0」
我也試過:
m_res->getInt64("datum");
m_res->getUInt64("datum");
具有相同的錯誤代碼(m_res不爲空)。
感謝您的幫助!
'DATETIME'既不是字符串,也不是一個整數值。 – user0042
sql :: ResultSet沒有getDateTime()函數,這是我的問題 – janos